EarthWeb
Developer.com
Site
windows 2000
visual c++
java
visual basic
javascripts
recommend it
 
Book
thinking in java
 
Interact
forum
guest book
jobs
jokes
what's new

share code
 
Resource
add resource
modify resource
new resource
 

[Internet Jobs]
-----
Java by E-mail:

Get the weekly e-mail highlights on Java!
-----

-

Look & Feel to match the native OS


Author: Zafir Anjum

Select a L&F that matches the look and feel of the native OS.


try {
	UIManager.setLookAndFeel(  UIManager.getSystemLookAndFeelClassName() );
}
catch (Exception e) {}

Note that the native L&F should be installed for this to work.

Here's a sample program.


import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.tree.*;


public class Tree
{
	static JTree tree ;
	
	public static void main(String[] args)
	{
		JFrame frame = new JFrame("Tree");
		frame.addWindowListener( new WindowAdapter() {
			public void windowClosing(WindowEvent e)
			{
				Window win = e.getWindow();
				win.setVisible(false);
				win.dispose();
				System.exit(0);
			}
		} );
		
		frame.getContentPane().setLayout( new BorderLayout() );
		
		
		try {
			UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
		}
		catch (Exception e) {}

		tree = new JTree();
	
		JScrollPane sp = new JScrollPane( tree );
		frame.getContentPane().add( sp, "Center" );

		frame.pack();
		frame.show();
	}
}

Posted On: 21-Feb-1999

internet.commerce
Partner With Us
Laptops
US Passports
Corporate Gifts
Car Donations
Calling Cards
Online Education
Corporate Awards
Web Hosting Directory
Web Design
Compare Prices
Shop Online
Promote Your Website
Ram Memory
Best Price



Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers