Native Look and Feel in Java

By default a Swing application or applet does not have the native look and feel of the operating system. This Java tutorial shows how to modify your application to use the correct look and feel for the platform.

By default the look and feel is Aqua in Java 1.5 and Metal in prior versions. The following image shows a sample of an application using the default look and feel of Aqua in Java 1.5:

If you want your application to have the native look and feel instead of the generic Aqua or Metal look and feel, you can simply add a few lines of code to your application to set the native look and feel.

//Tell the UIManager to use the platform look and feel
catch(Exception e)
//Do nothing
After adding the code, the application the will now have the native look and feel of the platform. Here is the resulting application running on an application running on Windows XP.

If you have Windows XP set to use the Windows Classic style, the application will have the correct look and feel as seen below.

Related Links:
JTabbedPane in Windows XP


dany said...

Ok and can i use the Windows XP LookAndFeel even if my OS is Windows 2000 ?

Anonymous said...


You can't use the WinXP LnF if your OS is Win2k... "native look and feel" means exactly that.. i.e. make your app look "native".

Anonymous said...

Thanks. Just one think: you have to

import javax.swing.UIManager;


am making an applet in netbeans.and am a beginner in java,can u plsssssssssssss help where to put this code in my applet??will it be in init() function???and one more thing how can i use other look and feel or substances to my applet.

Post a Comment