Bonjour à tous, étant en stage j'ai une appli à développer j'ai donc une classe principale:
Et plusieurs autres classes qui sont des Jinternalfram comme celle ci :
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
69
70
71
72 import java.awt.Dimension; import java.awt.GraphicsEnvironment; import java.awt.Rectangle; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JToolBar; public class accueil { .............. /** * This method initializes accueil * * @return javax.swing.JFrame */ private JFrame getAccueil() { if (accueil == null) { accueil = new JFrame(); //accueil.setSize(new Dimension(1024, 764)); GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); Rectangle bounds = graphicsEnvironment .getMaximumWindowBounds(); accueil.setBounds(bounds); accueil.setJMenuBar(getJJMenuBar()); accueil.setTitle("Gescom"); accueil.setName("accueil"); accueil.setResizable(false); accueil.setContentPane(getJContentPane()); accueil.setVisible(true); accueil.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } return accueil; } ................. /** * This method initializes jDPaccframe * * @return javax.swing.JDesktopPane */ private JDesktopPane getJDPaccframe() { if (jDPaccframe == null) { jDPaccframe = new JDesktopPane(); jDPaccframe.setBounds(new Rectangle(1, 24, 1017, 644)); jDPaccframe.add(new statistiqueglob()); } return jDPaccframe; } public static void main(String[] args){ accueil test = new accueil(); test.getAccueil(); } }
Le probleme c'est que je n'arrive pas à afficher ma frame interne dans ma frame principale. Comme vous pouvez le voir dans la classe principale j'essaye d'appeler ma frame interne dans mon Jdesktoppane mais Jbuider me renvoi des erreurs. J'ai deja essaye plusieurs trucs apres avoir regarde sur le net mais sans résultats positifs.
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 import java.awt.Dimension; import java.awt.Rectangle; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; public class statistiqueglob extends JInternalFrame { private JInternalFrame jIFstateglob = null; // @jve:decl-index=0:visual-constraint="77,15" private JPanel jContentPane = null; private JPanel jPstateglob = null; private JLabel jLabel = null; private JLabel jLabel1 = null; private JLabel jLabel2 = null; private JLabel jLabel3 = null; private JLabel jLabel4 = null; private JLabel jLabel5 = null; private JLabel jLabel6 = null; private JLabel jLabel7 = null; private JLabel jLabel8 = null; private JTextArea jTextArea = null; private JTextArea jTextArea1 = null; private JTextArea jTextArea2 = null; private JTextArea jTextArea3 = null; /** * This method initializes jIFstateglob * * @return javax.swing.JInternalFrame */ private JInternalFrame getJIFstateglob() { if (jIFstateglob == null) { jIFstateglob = new JInternalFrame(); jIFstateglob.setSize(new Dimension(740, 403)); jIFstateglob.setVisible(true); jIFstateglob.setContentPane(getJContentPane()); jIFstateglob.setDefaultCloseOperation(JInternalFrame.EXIT_ON_CLOSE); } return jIFstateglob; } ............... /** * @param args */ public static void main(String[] args) { statistiqueglob st =new statistiqueglob(); st.getJIFstateglob(); } }
Dans le code que j'ai mis j'ai enlevé le code superflu pour eviter de surcharger. Merci d'avance de votre aide.
Partager