Nimbus Look and Feel

These documentation pages are no longer current. They remain available for archival purposes. Please visit https://docs.oracle.com/javase for the most up-to-date documentation.

 

Contents

Introduction

Nimbus, a cross platform look and feel introduced in the Java SE 6 update 10 release, is drawn with 2D vector graphics and can be rendered at any resolution.

Nimbus Look and Feel Example

 

Activating Nimbus Look and Feel

There are two ways to activate the Nimbus Look and Feel.

Invoking UIManager.setLookAndFeel

Add the following snippet to your source code:

try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (UnsupportedLookAndFeelException e) {
// handle exception
} catch (ClassNotFoundException e) {
// handle exception
} catch (InstantiationException e) {
// handle exception
} catch (IllegalAccessException e) {
// handle exception
}

-Dswing.defaultlaf command line option

To activate Nimbus Look and Feel for an application, specify the following when running the Java application

-Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel

 




Oracle and/or its affiliates
Java Technology

Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved.

Contact Us