This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTree" Watch "JTree" New topic
Author

JTree

Pink Stac
Greenhorn

Joined: Nov 01, 2001
Posts: 2
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

Joined: Jan 09, 2001
Posts: 1492
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

Joined: Nov 01, 2001
Posts: 2
Thanks a lot
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: JTree