问题
Is there a way to hide the collapse [-] and expand [+] button on a java file JTree
?
If it's not possible, is there a way to change it to a different icon?
回答1:
Yes to both: You can specify an empty Icon
, as shown here. You can substitute your own implementation, as shown here. These are the relevant UIManager
keys:
UIManager.put("Tree.collapsedIcon", empty);
UIManager.put("Tree.expandedIcon", empty);
来源:https://stackoverflow.com/questions/16953688/hide-change-collapse-and-expand-button-on-jtree