Hi all,
JButtons by default creates rectangular buttons. I'd like to change the shape to a circle. The following is my code:
public void createButtons(JPanel bottomPanel) { JButton[] buttons = new JButton[16]; String[] alphabets = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"}; for (int i = 0; i < buttons.length; i++) { buttons[i] = new JButton(alphabets[i]); buttons[i].setSize(40, 40); buttons[i].setActionCommand(alphabets[i]); buttons[i].addActionListener(this); bottomPanel.add(buttons[i]); } }
The point is i want the shape of the buttons to be circular and not the default rectangular shape. Any ideas?