Forum Stats

  • 3,875,722 Users
  • 2,266,954 Discussions


SwiXml - Issue in providing checkbox for JTree nodes

User_6T1AO Member Posts: 248 Employee
edited Aug 16, 2013 3:28AM in Java Desktop Applications


We are using SwiXml 1.5 to develop a UI. We are getting issue while displaying JTree with checkbox option. We found below url to achieve the same thing

We have customised the class as per SwiXml

We have configured the XML with InitClass as below

<scrollpane id="ehdd_task_tree"> 

        <gridbagconstraints insets="5,5,5,5" gridx="1" gridy="1" weightx="1.0" 

                            weighty="1.0" fill="GridBagConstraints.BOTH" 


        <tree id="ehdd_tree" initclass="" Font="ARIAL-BOLD-14" VisibleRowCount="10" RootVisible="TRUE" ExpandsSelectedPaths="true"/> 


Following is


    public class TreeTest extends DefaultTreeModel  



      protected final static String[] questions = { "A","B","C" }; 

      DefaultMutableTreeNode root ; 


      public TreeTest() { 

        super(new DefaultMutableTreeNode ("ROOT")); 

          root = (DefaultMutableTreeNode)super.getRoot(); 

          JTree tree = new JTree( getRootNode() ) { 

          public boolean isPathEditable(TreePath path) { 

            Object comp = path.getLastPathComponent(); 

            if (comp instanceof DefaultMutableTreeNode) { 

              DefaultMutableTreeNode node = (DefaultMutableTreeNode) comp; 

              Object userObject = node.getUserObject(); 

              if (userObject instanceof TrueFalseTreeNodeData) { 

                return true; 



            return false; 



        tree.setCellRenderer(new QuestionCellRenderer()); 

        tree.setCellEditor(new QuestionCellEditor()); 




      protected MutableTreeNode getRootNode() { 

        DefaultMutableTreeNode child; 

        TrueFalseTreeNodeData question; 

        for (int i = 0; i < questions.length; i++) { 

          question = new TrueFalseTreeNodeData(questions[i]); 

          child = new DefaultMutableTreeNode(question); 



        return root; 



We can find other required class files(QuestionCellRenderer/QuestionCellEditor/TrueFalseTreeNodeData) from the URL

We are successfully executed the jave program given in above URL. We are getting issue with our customization according SwiXml.

We are getting A=false,B=false,c=false under ROOT. Some how, could not able to provide checkbox for the subnodes of tree.

Please suggest, if Iam doing some thing wrong.

It would be really great help, if you can suggest on this.




This discussion has been closed.