List of usage examples for javax.swing AbstractButton setFocusPainted
@BeanProperty(visualUpdate = true, description = "Whether focus should be painted") public void setFocusPainted(boolean b)
paintFocus
property, which must be true
for the focus state to be painted. From source file:Main.java
public static void main(String[] args) { AbstractButton jb = new JToggleButton("Press Me"); jb.setFocusPainted(false); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(jb);/*from w ww. ja va2 s .co m*/ f.pack(); f.setVisible(true); }
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 .ja v a 2 s.co m*/ 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); } }