October 21, 2018
Hot Topics:

User Code: Using the Windows JTree Icons in Any Look and Feel

  • May 17, 2001
  • By Steve Rylander
  • Send Email »
  • More Articles »

Here's how you can use the expand and collapse node icons (on a JTree) from the Windows "look and feel" within another look and feel.

Place the following lines at the beginning of your application:

UIManager.put("Tree.expandedIcon",  new WindowsTreeUI.ExpandedIcon()); 
UIManager.put("Tree.collapsedIcon", new WindowsTreeUI.CollapsedIcon());

Also, include the following import in the class: import com.sun.java.swing.plaf.windows.*;

Any JTree objects will now use the plus and minus icons!

This article was contributed by Steve Rylander.

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that developer.com may send you developer offers via email, phone and text message, as well as email offers about other products and services that developer believes may be of interest to you. developer will process your information in accordance with the Quinstreet Privacy Policy.


Thanks for your registration, follow us on our social networks to keep up-to-date