je veux changer l'apparence d'un bouton en lui imposant une forme ovale.
serait-il possible de colorier l'intérieur du cercle ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 public class JButtonPinpad extends JButton { public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; // affichage du cercle g2.drawOval(this.getHorizontalAlignment(), this.getVerticalAlignment(), this.getWidth(), this.getHeight()); g2.setColor(Color.green); } }
Partager