Java Utililty Methods Swing Look and Feel

List of utility methods to do Swing Look and Feel

Description

The list of methods to do Swing Look and Feel are organized into topic(s).

Method

booleanisWindowsModernLookAndFeel()
is Windows Modern Look And Feel
if (!isWindowsXPLookAndFeel())
    return false;
String osName = System.getProperty("os.name"); 
return osName != null && (osName.contains("Windows 8") || osName.contains("Windows 10")); 
booleanisWindowsUI()
Check if we are using one of the Windows Look and Feels.
return isWindowsNewUI() || isWindowsClassicUI();
booleanisWindowsVistaLookAndFeel()
Determines if current Look and Feel is Windows XP LookAndFeel.
if (!isWindowsLookAndFeel()) {
    return false;
boolean xpThemeActiveOS = Boolean.TRUE
        .equals(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive")); 
boolean xpThemeDisabled = (System.getProperty("swing.noxp") != null); 
boolean vistaOs = System.getProperty("os.version").startsWith("6.0");
return ((xpThemeActiveOS) && (!xpThemeDisabled) && vistaOs);
...
booleanisWindowsXPLookAndFeel()
Determines if current L&F is Windows XP LookAndFeel
if (!isWindowsLookAndFeel()) {
    return false;
boolean xpThemeActiveOS = Boolean.TRUE
        .equals(Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive")); 
boolean xpThemeDisabled = (System.getProperty("swing.noxp") != null); 
boolean vistaOs = System.getProperty("os.version").startsWith("6.0");
return ((xpThemeActiveOS) && (!xpThemeDisabled) && !vistaOs);
...
booleanisWinLAF()
is Win LAF
return UIManager.getLookAndFeel() != null && "Windows".equals(UIManager.getLookAndFeel().getID());
booleanisWinLAF()
is Win LAF
return UIManager.getLookAndFeel() != null && "Windows".equals(UIManager.getLookAndFeel().getName());
booleanisXP()
is XP
if (isWindows()) {
    Boolean b = (Boolean) Toolkit.getDefaultToolkit().getDesktopProperty("win.xpstyle.themeActive");
    if (b != null && b)
        return true;
return false;
voidlistLookAndFeels()
list Look And Feels
LookAndFeelInfo[] lafs = javax.swing.UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo laf : lafs) {
    System.out.println(String.format("%s: %s", laf.getName(), laf.getClassName()));
voidlookAndFeelDefault(String style)
look And Feel Default
try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if (style.equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
} catch (Exception e) {
...
voidlookLikeSystem()
Sets the GUI to look like the systems standard GUI.
try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
    e.printStackTrace();
} catch (InstantiationException e) {
    e.printStackTrace();
} catch (IllegalAccessException e) {
    e.printStackTrace();
...