Bonjour,
Quelqu'un saurait me dire pourquoi ma fonction paintComponent de la classe PF n'est pas appelée ?
Voici à peu près l'organisation de la classe ( pas mis certaines choses non importante )
Merci d'avance ..
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 public class Fenetre { private JFrame jframe; public Fenetre() { jframe = new JFrame(" works"); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setLayout(new BorderLayout()); jframe.setLocationRelativeTo(null); jframe.setContentPane(new P()); jframe.pack(); jframe.setVisible(true); } public class P extends JComponent { public P() { this.setPreferredSize(new Dimension(WI,HI)); this.add(new PF()); } public class PA extends JComponent { @Override protected void paintComponent(Graphics g) { DrawX(g); DrawY(g); } public void DrawX(Graphics g) { \* .. */ } public void DrawY(Graphics g) { \* ..*/ } } public class PF extends PA { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); drawS(g); drawT(g); } public void drawS(Graphics g) { \* .. */ } public void drawT(Graphics g) { \* ... */ } } } }
Partager