Saturday, June 24, 2006

A killer Java Component called TreeComboBox

I was lately thinking of developing something which could hold me in front of my development computer at home for a couple of days! (i badly needed to develop something new like the CheckBoxRadioButtonTree and the killer TableCheckBoxCellEditor)

So apart from working on JAnimationShop, i started working on a reusable component called TreeComboBox, which i found to be very interesting.

This is a killer component and in the Java third party component market, i have seen this only on the JIDE components package. I had a chance to take some time off work ;) and look into JIDE demos at office since i was evaluating some of their components for prospective usage in the GUI of the product that i am working on, and found TreeComboBox to be very innovative though not new.

I have also done some more components in the past which are similar to those in the JIDE repository, but then i did not know that something called JIDE existed. Will post about those sometime later.


The TreeComboBox is an extension of JComboBox with a JTree embedded in its dropdown popup. So, instead of searching and selecting the necessary list item from huge list of dropdown items, user will be able to see an elegant tree structure, select the tree nodes, expand and collapse them and possibly do anything they can do with a normal JTree.


The TreeComboBox can take a ready made JTree or can take a TreeModel and create a JTree from it, and can show the tree in the combo popup.

This one took me almost a day to develop! I had to put in too much thought into get it working to the fullest effect. I am now in the process of cleaning up the code and removing internal dependencies(if any) and make all fields private/protected and provide accessor methods to those. After all , this can be actually called a Component only after doing all these ;)

7 comments:

Gio said...

Hi, I just read your post on the TreeComboBox component. It just so happens that I was looking for something exactly like that. Would you be willing to share the source code?

Thanks for your time!

Ranganath Prasannakumar said...

I probably can, drop me a mail...

Subin KS said...

Hi ,

I am new to Swing , and i also was looking for a similar ComboBox. Will it be possible to share the source code'


Subin K S

Subin KS said...

Hi,


I am Subin, and i am new to Swing. I was also looking for a similar ComboBox. Will it be possible to share the source code...


my mail id : sksubin@gmail.com

Subin KS said...

HI ,

I am Subin, and i am new to Swing. I also was looking for a similar kind of ComboBox. Will it be possible to share the source code..

my email id : sksubin@gmail.com

Subin KS said...

HI , I am subin , new to Swing, i was also looking for such a UI control. Will you share the source Code

bikash shrestha said...

hi, can you please share the code. I am looking for something similar.

my email is: bikash.shrestha@gmail.com