How to set the button color of a JButton (not background color)

后端 未结 5 1142
情话喂你
情话喂你 2021-01-13 04:08

I have a JButton that I would like to change the background color of to white. When using the Metal Look And Feel, I achieve the desired effect with setB

5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-13 04:49

    instead of messing with the button's background color, could you do whatever indication you're trying to show a different way?

    displaying an Icon, making the button bold instead of plain text, etc.

    Indicating something only through a different background color isn't always obvious, and depending on the user's system colors, may be jarring, or invisible.

    for example, what if the user is running windows in "high contrast" mode?

提交回复
热议问题