Bonjour
ma question est pourquoi on a mit ça super(str);
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 public class ClasseBouton extends JButton { private String name; public ClasseBouton(String str) { super(str); this.name = str; } public void paintComponent(Graphics gr) { Graphics2D g2dr = (Graphics2D)gr; GradientPaint gpr = new GradientPaint(0, 0, Color.black, 0, 20, Color.black, true); g2dr.setPaint(gpr); g2dr.fillRect(0, 0, this.getWidth(), this.getHeight()); g2dr.setColor(Color.green); g2dr.drawString(this.name, this.getWidth() / 2 - (this.getWidth() / 2 /4), (this.getHeight() / 2) + 5); } }
this.name = str;
Merci de m'avoir aider à comprendre
A+
Partager