Вот некоторые методы, которые должны быть переписаны, чтобы изменить форму компонента. (В том числе примеры кода)
protected void paintComponent(Graphics g)
{
if (getModel().isArmed()) {
g.setColor(Color.lightGray);
} else {
g.setColor(getBackground());
}
g.fillOval(0, 0, getSize().width-1,getSize().height-1);
super.paintComponent(g);
}
protected void paintBorder(Graphics g) {
g.setColor(getForeground());
g.drawOval(0, 0, getSize().width-1, getSize().height-1);
}
Shape shape;
public boolean contains(int x, int y) {
if (shape == null ||
!shape.getBounds().equals(getBounds())) {
shape = new Ellipse2D.Float(0, 0, getWidth(), getHeight());
}
return shape.contains(x, y);
}
нужно учитывать, что [ссылка только ответы, как правило, должны быть удалены] (http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links- в другом месте, на самом деле-хорошие-ответы) –