Thursday, February 02, 2006

GUI components are so complex!


Lately i have been busy on developing a complex UI component in Java, basically a Tree (the component which can be generally seen on the left pane, of any graphical file browser, which displays the hierarchical list of files and directories), a JTree (javax.swing.JTree) to be more specific. The requirement is that the first level nodes of the tree need to be CheckBoxes (e.g. AppleOrange) and the second level nodes should be RadioButtons (e.g. YesNo), the tree should look like in the picture above. This is probably one of the very complex UI components I have come across till date, had done some of those for JAnimationShop but nothing related to JTree as such.

In Java, customizing the JTree can be done through components called TreeCellRenderer and TreeCellEditor, still the complexity comes out of the fact that the state of the nodes with respect to checkbox/radiobutton should be retained, and also the user should be able to modify the state of checkbox/radiobutton.

This sounds very easy at first glance, but the catch here is that the state should not change if the user selects a node, it should only change when he explicitly clicks on the checkbox/radiobutton, so the expansion/contraction/selection of a node in the tree does not contribute to changing the state of checkbox/radiobutton, people who have worked with JTree will definitely agree on the fact that it's a tough nut to crack, frankly speaking, nothing has held me for two days till now ;-|.

Started working on it yesterday... Still climbing the tree ;-)... probably, I could finish this atleast today...


Human diversity makes tolerance more than a virtue; it makes it a requirement for survival. - Rene Dubos

0 comments: