I'm not sure where I read this (old article), but since I read it I use it in all commercial desktop applications I make.
First thing get NetBeans, it's the perfect IDE for Java UI design. The other Eclipse plugins are not as helpful nor powerful.
Here is how I do it.
In NetBeans, create a new Java project — let's call it MyComponents
in this project — create all your components you want. The base of any component should be a JFrame
or a JPanel
. For this example we'll choose JPanel
and call it mjPanel
Next in the Design view, drag and drop all the Swing components you want. Then from the Source view, make all the actions and logic.
Next, the most important step, right click your Java file, from Tools, choose Add to Palette, then in the dialog, choose where you want to put it, like say Swing Components Palette.
To finalize your component, from Build menu, choose Clean and Build, this will create you a Jar file in the project folder/dist.
From now on, in each project you want to use this component, just include the Jar file in your project classpath.
Open the Swing Components Palette, and you will see your new component.
Like this: