如何使我的树单元格填充我的 JTree 的宽度:
JTree tree = new JTree();
tree.setCellRenderer(new TreeCellRenderer() {
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
// TODO: How do I make this panel fill the width
// of the JTree?
JPanel panel = new JPanel();
panel.add(new JLabel("ITEM");
return panel;
}
});
add(tree);