How to Set the Background Color of a JButton on the Mac OS

前端 未结 5 1815
Happy的楠姐
Happy的楠姐 2020-11-30 08:55

Normally with Java Swing you can set the background color of a button with:

myJButton.setBackground(Color.RED);

which would cause the butto

5条回答
  •  北海茫月
    2020-11-30 09:00

    Have you tried setting the painted border false?

    JButton button = new JButton();
    button.setBackground(Color.red);
    button.setOpaque(true);
    button.setBorderPainted(false);
    

    It works on my mac :)

提交回复
热议问题