Add a Datapicker to the Netbeans Swing Controls Palette


For small Swing applications, I like to use the Netbeans GUI Builder.  The problem is that there is no date picker.  And today, I really needed a date picker.  Fortunately, there is a solution.  Remember SwingX?  It’s built into Netbeans, and it has a good date picker called JXDatePicker.  Here’s how to get it on your Swing Controls palette so that you can drag it onto your form.

By “palette”, I mean the view that pops up on the right side of the IDE when you use the GUI Builder.  Notice that the Swing Controls palette doesn’t have a date picker of any sort (shame on you Netbeans! This is basic stuff!).

The goal is to get JXDatePicker onto that palette.

1.) Pull up the Palette Manager for Swing/AWT Components.

2.)  Click “Add from JAR”

3.) Browse to [NETBEANS HOME]\ide\modules\ext and select swingx-0.9.5.jar

4.)  This will bring up a list of all the components available for the palette.  Lots of goodies here!  Select JXDatePicker.

5.)  Select Swing Controls

It will immediately show up on your Swing Controls palette.  All that’s left is to drag onto form!

Advertisements

57 thoughts on “Add a Datapicker to the Netbeans Swing Controls Palette

  1. Thanks for showing how to add the data picker. When I tried it out it appeared to only allow choosing dates in the current month. Is it possible to configure to allow choosing dates in future months as well, or am I missing something obvious?

    Thanks,

    Charles

    • Charles,

      I’m not in a position to answer this at the moment. I’m in a new environment where I’m using Eclipse and GWT. Perhaps someone else will come along and answer. Good luck.

  2. When I use this chooser, the arrows at the top allow you to scroll through the months. Setting future dates is no problem.

  3. Hello, It was my mistake. It would only show the current month in “Design Preview” mode. When I actually ran my application the date picker was fully functional, allowing me to choose dates in other months by scrolling using the arrows Andy mentions. Thanks for your consideration. – Charles

    • Click “Add From Jar”. It should give you some sort of file selector that allows you to browse to where ever you installed Netbeans. From there, browse to ide\modules\ext and select swingx-0.9.5.jar by clicking each directory until you get to the jar file. I don’t know what else to tell you.

  4. When i added the datepicker in my palette i dragged and dropped it over the frame i wanted to put it6 in yet i am not getting any output of the container. Do i need to drop it over any other container or simply drop it over the frame. and after doing this , the code snippet should be mentioned in where? the frame? i may sound ambiguous but any sort of help would be helpful. i am new to this

  5. Hello! And thank you for your article!
    I have a doubt. How can I see where the new components are? I mean: if I create a new component and I add it to the palette, what file is saved in?
    Thank you in advance!

  6. Many thanks David. Yours was the first result I found when I hit the search engine. Every once in a while one finds a useful sought after gem online. Bravo!

  7. Thanks so much. I’m working in netbeans 8.0.2. I had to make a few guess’s in the procedure but it is now working in my app perfectly. The type for the date is Date. Now I need to find out how to parse the date to get a string that
    has the format mm/dd/yyyy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s