Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to change the shape of JButton?

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

like image 341
Vikram Avatar asked Jul 31 '12 14:07

Vikram


2 Answers

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);
like image 147
exexzian Avatar answered Sep 27 '22 01:09

exexzian


You can also use an image over the button .

like image 29
Rish Avatar answered Sep 23 '22 01:09

Rish