Wednesday, May 14, 2008

Installing SwingX in NetBeans 6.1

SwingX adds some really nice UI and other improvements to Swing. It's sponsored by Sun, and may be released in a future version of Java, but appears stable enough to use in projects now.

There's a tutorial on how to set it up, but it's missing some important content, so here's how I did it:

1. Download and unzip from http://swinglabs.org/downloads.jsp
2. Place swingx-x.x.x.jar file (from swingx/dist/ folder) in a place that you won't delete it later.
3. Open your project in NetBeans, right-click on "libraries", and choose "Add Library..."
4. Click on "Create...", give it a name (i.e. "SwingX"), and select "Class Libraries".
5. On the next dialog box, under the "Classpath" tab, click "Add JAR/Folder..." and locate the swingx-x.x.x.jar file from step 2.
6. Add the new library to your project.
7. To get the visual items in the palette, go to a jFrame or other class that has a design view, right-click anywhere on the Palette view, and select "Palette Manager...".
8. Click on "New Category..." and type "SwingX" (or whatever you want to call it).
9. Click on "Add from JAR...".
10. Find your swingx.x.x.x.jar file again, and on the next screen, select all the components you want to be displayed.
11. Finally, select the category folder you just created in step 8.

1 comment:

Anonymous said...

This worked great for me, Thanks! I got a little hung up on finding the "Pallet Manager" but right clicking the "Swing Controls" divider in the Pallet pull out on the right side of netbeans displayed what I needed. Much appreciated!