This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTree

 
Pink Stac
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im using JTree .The default symbol of the closed and open icon is a circle with a dot in it.I want the explorer look.ie a plus and minus sign.If i use an icon it attatches it after the already existing symbol...
Kindly suggest how can i do it
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pink,
Look at the javax.swing.UIManager. To get the WindowsLookAndFeel you just use the following before you create your tree:
try
{
UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel" );
}
catch( Exception e ) {};
This will change all components created to WindowsLookAndFeel if you don't want that then you need to perform the exact thing again after your tree is created to get back to whatever look and feel you want. For example:
try
{
UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() );
}
catch( Exception e ) {};
could be used to get back to the Metal LookAndFeel.
Regards,
Manfred.
 
Pink Stac
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic