ploblem in jcheckbox

From: yew y via JavaKB.com (forum_at_JavaKB.com)
Date: 03/30/05


Date: Wed, 30 Mar 2005 02:48:39 GMT

i was new in java and i now completed add the checkbox in each node but the
ploblem is i cant click the check box..
what should i do in next step... pls help me thank you..
following is my code

 fileTree.setCellRenderer(new DefaultTreeCellRenderer()
          {
          public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
          {
          super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
row, hasFocus);
          JCheckBox chk = new JCheckBox();
          chk.setContentAreaFilled(false);
          chk.setEnabled(true);
          //
          chk.setBorderPaintedFlat(true);
      chk.setOpaque(false);
      
          JPanel jPanel = new JPanel(new BorderLayout());
          jPanel.add(chk, BorderLayout.WEST);
          jPanel.add(this, BorderLayout.EAST);
          return jPanel;
          }

-- 
Message posted via http://www.javakb.com


Relevant Pages