问题
If I set Metal theme for Swing GUI, JButton border is painted around the whole button, but focus border is painted only around JButton's text and icon, so if text size is smaller than button size, the border appears inside button. Most replies to this problem simply suggest to disable global focus border painting by
UIManager.getLookAndFeelDefaults().put("Button.focus", new ColorUIResource(new Color(0, 0, 0, 0)));
or per-button by jButton.setFocusPainted(false);
But I actually want focus border to be painted - like in Nimbus LAF around the whole button. I suppose I need to override focus painter with default one for Button.border, but can't find which one. Maybe someone can help me?
来源:https://stackoverflow.com/questions/55087137/java-swing-metal-jbutton-focus-border-size