Possible to change the shape of JButton?

后端 未结 2 1316
太阳男子
太阳男子 2021-01-01 03:49

Is it possible to change the shape of JButton from rectangular to say round?

2条回答
  •  無奈伤痛
    2021-01-01 04:26

    Link provided by Sean Cogan is all you need. If you want it in short ,set an image (rounded or any shape that you want your button should look alike) using setIcon and then on the JButton (button1) set these values -

    button1.setContentAreaFilled(false);
    button1.setFocusPainted(false);
    button1.setBorderPainted(false);
    

提交回复
热议问题