Example usage for javax.swing LookAndFeel isNativeLookAndFeel

List of usage examples for javax.swing LookAndFeel isNativeLookAndFeel

Introduction

In this page you can find the example usage for javax.swing LookAndFeel isNativeLookAndFeel.

Prototype

public abstract boolean isNativeLookAndFeel();

Source Link

Document

If the underlying platform has a "native" look and feel, and this is an implementation of it, return true .

Usage

From source file:Main.java

/**
 * With certain look and feels, namely windows with XP style, the focus of a toolbar button is already indicated (border changes) and the focus indicator should not be drawn: this fixes the visual rendering.
 * @param toolBarButton the tool bar button for which to adjust the focus state.
 *//* w  w  w  .  j  ava  2  s.c  om*/
public static void adjustToolbarButtonFocus(AbstractButton toolBarButton) {
    LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
    if (lookAndFeel.isNativeLookAndFeel() && System.getProperty("os.name").startsWith("Windows")
            && !Boolean.parseBoolean(System.getProperty("swing.noxp"))
            && !lookAndFeel.getClass().getName().endsWith("WindowsClassicLookAndFeel")) {
        toolBarButton.setFocusPainted(false);
    }
}