Next page | Contents page |

Pluggable look and feel

Put this at the start of main () to make an application look native (ie, like the platform on which it is running):

	try
	{
		UIManager.setLookAndFeel (
				UIManager.getSystemLookAndFeelClassName ());
	}
	catch (Exception ex) {  }  // Really doesn't matter

OR, experiment with settings available in javax.swing.LookAndFeel.

Java's own look and feel (not Windows, Unix etc) is implemented by javax.swing.plaf.metal.MetalLookAndFeel and this has themes controlled by abstract class MetalTheme, of which DefaultMetalTheme is a supplied subclass. For the really creative:

	MetalLookAndFeel.setCurrentTheme (new MyCustomTheme ());
	UIManager.setLookAndFeel (new MetalLookAndFeel ());

Heavyweight vs lightweight components

Heavyweight components depend on native features of the underlying operating system to display themselves and do their work. Components in awt are all heavyweight.

Swing components do all the work themselves - lightweight. This makes it possible to vary the look and feel.

Next page | Contents page |