Changing the background color of a selected JToggleButton

后端 未结 6 2173
暗喜
暗喜 2020-12-07 01:49

I am trying to change the color of a JToggleButton when it has been selected in a reliable, look and feel independent way.

If using the Metal L&F, t

6条回答
  •  渐次进展
    2020-12-07 02:10

    JToggleButton btn = new JToggleButton(...);
    btn.setUI(new MetalToggleButtonUI() {
        @Override
        protected Color getSelectColor() {
            return Color.RED;
        }
    });
    

提交回复
热议问题