简体   繁体   中英

Replace JTree handle icons

I'm trying to customize a JTree so that I can use it in a project that I'm working on. That project GUI's style does not fit the default Java LNF's node handles for JTree which is why I tried to replace them with custom-made icons but I'm stuck as to how I can do that. I don't know if that helps but I already have an own LNF class which loads the default LNF settings and overrides some of them with custom values.

Alternatively, if replacing the handles' icons is too complex to explain it in an answer here, how can I completely disable them so that I can use custom open/closed icons for all expandable nodes?

By setting the UIManager properties Tree.collapsedIcon (for collapsed handles) and Tree.expandedIcon (for expanded handles) to the desired values, the handles for all JTree s can be changed at once. Thanks to @MadProgrammer for suggesting the examples shown here , here , here and here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM