Y
yew y via JavaKB.com
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;
}
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;
}