Color (AbstractButton b) { ButtonModel bm = b.getModel(); Color focusedColor = (Color)b.getClientProperty("JButton.focusedBackgroundColor"); if (bm.isPressed()) { return focusedColor != null ? focusedColor : UIManager.getColor("Button.intellij.native.pressedBackgroundColor"); } else if (b.hasFocus() || bm.isRollover()) { return focusedColor != null ? focusedColor : UIManager.getColor("Button.intellij.native.focusedBackgroundColor"); } else { Color backgroundColor = (Color)b.getClientProperty("JButton.backgroundColor"); return backgroundColor != null ? backgroundColor : b.getBackground(); } }