Bonjour,

Je débute en java et je suis paumé depuis un bon moment...
Pour présenté le contexte, j'ai deux classe :
  1. Une JFrameForm pour faire ma fênetre avec des 2JPanel et une InternalFrame
    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
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    public class TestPanel extends JFrame {
     
     
     
        public TestPanel() {
            initComponents();
        }
     
        /**
         * This method is called from within the constructor to initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is always
         * regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            jTabbedPane1 = new javax.swing.JTabbedPane();
            PanelCon = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            PanelMenu = new javax.swing.JPanel();
            jLabel1 = new javax.swing.JLabel();
            MainWindowCal = new javax.swing.JInternalFrame();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
     
            jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jButton1.setText("Ici bouton");
     
            jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
            jButton2.setText("Encore lui");
     
            javax.swing.GroupLayout PanelConLayout = new javax.swing.GroupLayout(PanelCon);
            PanelCon.setLayout(PanelConLayout);
            PanelConLayout.setHorizontalGroup(
                PanelConLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelConLayout.createSequentialGroup()
                    .addContainerGap(33, Short.MAX_VALUE)
                    .addGroup(PanelConLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                        .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGap(33, 33, 33))
            );
            PanelConLayout.setVerticalGroup(
                PanelConLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PanelConLayout.createSequentialGroup()
                    .addGap(40, 40, 40)
                    .addComponent(jButton1)
                    .addGap(18, 18, 18)
                    .addComponent(jButton2)
                    .addContainerGap(385, Short.MAX_VALUE))
            );
     
            jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
            jLabel1.setForeground(new java.awt.Color(0, 153, 153));
            jLabel1.setText("Ici le titre ");
     
            javax.swing.GroupLayout PanelMenuLayout = new javax.swing.GroupLayout(PanelMenu);
            PanelMenu.setLayout(PanelMenuLayout);
            PanelMenuLayout.setHorizontalGroup(
                PanelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PanelMenuLayout.createSequentialGroup()
                    .addGap(30, 30, 30)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            PanelMenuLayout.setVerticalGroup(
                PanelMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(PanelMenuLayout.createSequentialGroup()
                    .addGap(25, 25, 25)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(18, Short.MAX_VALUE))
            );
     
            MainWindowCal.setVisible(true);
     
            javax.swing.GroupLayout MainWindowCalLayout = new javax.swing.GroupLayout(MainWindowCal.getContentPane());
            MainWindowCal.getContentPane().setLayout(MainWindowCalLayout);
            MainWindowCalLayout.setHorizontalGroup(
                MainWindowCalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 767, Short.MAX_VALUE)
            );
            MainWindowCalLayout.setVerticalGroup(
                MainWindowCalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 459, Short.MAX_VALUE)
            );
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(PanelMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(4, 4, 4)
                            .addComponent(MainWindowCal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(PanelCon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(PanelMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(PanelCon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(26, 26, 26)
                            .addComponent(MainWindowCal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap())
            );
     
            pack();
        }// </editor-fold>                        
     
     
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(TestPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(TestPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(TestPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(TestPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
     
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new TestPanel().setVisible(true);
                }
            });
        }
     
        // Variables declaration - do not modify                     
        private javax.swing.JInternalFrame MainWindowCal;
        private javax.swing.JPanel PanelCon;
        private javax.swing.JPanel PanelMenu;
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JTabbedPane jTabbedPane1;
        // End of variables declaration                   
    }
  2. et une autre classe Java extends JInternalFrame

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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
public class MainWindowCal extends JInternalFrame
{
	public static void main(String[] args)
	{
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainWindowCal window = null;
				try {
					window = new MainWindowCal();
					window.setVisible(true);
				}
				catch (Exception exp) {
 
				}
			}
		});
	}
 
	public MainWindowCal()
	{
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setTitle("MindFusion.Scheduling Sample: Minimal Application");
 
		calendar = new Calendar();
		calendar.setTheme(ThemeType.Light);
 
		JToolBar toolBar = new JToolBar();
		toolBar.setFloatable(false);
 
		nextButtonInToolbar(toolBar, imageFileNames[0]).addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				calendar.setCurrentView(CalendarView.SingleMonth);
			}
		});
 
		nextButtonInToolbar(toolBar, imageFileNames[1]).addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				calendar.setCurrentView(CalendarView.MonthRange);
			}
		});
 
		nextButtonInToolbar(toolBar, imageFileNames[2]).addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				calendar.setCurrentView(CalendarView.List);
			}
		});
 
		nextButtonInToolbar(toolBar, imageFileNames[3]).addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				calendar.setCurrentView(CalendarView.WeekRange);
			}
		});
 
		nextButtonInToolbar(toolBar, imageFileNames[4]).addActionListener(new ActionListener(){
			@Override
			public void actionPerformed(ActionEvent arg0) {
				calendar.setCurrentView(CalendarView.Timetable);
			}
		});
 
 
 
		Container cp = getContentPane();
		cp.setLayout(new BorderLayout());
		cp.add(toolBar, BorderLayout.PAGE_START);
        cp.add(calendar, BorderLayout.CENTER);
 
 
 
        // Initialiser le fichier de date
        _dataFile = new java.io.File("Schedule.dat").getAbsolutePath();
	}
 
	private void onWindowOpened() {
		if (new java.io.File(_dataFile).exists())
			calendar.getSchedule().loadFrom(_dataFile, ContentType.Xml);
	}
 
	private void exit() {
		calendar.getSchedule().saveTo(_dataFile, ContentType.Xml);
	}
 
	private JButton nextButtonInToolbar(JToolBar bar, String imageName)
	{
		JButton button = new JButton(new ThumbnailAction(imagedir, imageName));
		button.setBorderPainted(false);
		button.setMargin(new Insets(5, 5, 5, 5));
		button.setSize(35, 35);
 
		bar.add(button);
 
		return button;
	}
    /*
     * Liste de toutes les images à charger.
     */
    private String[] imageFileNames = { "0.png", "1.png", "2.png", "3.png", "4.png", "5.png"};
 
    private String _dataFile;
	private Calendar calendar;
	private String imagedir = "Resources/";
	private static final long serialVersionUID = 1L;
}
 
class ThumbnailAction extends AbstractAction
{
	public ThumbnailAction(String path, String imagePath)
	{
		// LARGE_ICON_KEY est la clé permettant de définir l'icône lorsqu'une action est appliquée à un bouton.
		ImageIcon icon = createImageIcon(path, imagePath);
		putValue(LARGE_ICON_KEY, icon);
	}
 
	private ImageIcon createImageIcon(String path, String fileName) {
        java.net.URL imgURL = getClass().getResource(path + fileName);
        if (imgURL == null)
        	imgURL = getClass().getResource("/" + path + fileName);
 
        if (imgURL != null) {
            return new ImageIcon(imgURL, fileName);
        } else {
            System.err.println("Couldn't find file: " + path);
            return null;
        }
    }
 
	@Override
	public void actionPerformed(ActionEvent e) {
	}
 
	private static final long serialVersionUID = 1L;
}
J'obtiens ceci lorsque je change l'extends de ma class MainWindowCal extends JInternalFrame en "extends JFrame"
Nom : MonCal.JPG
Affichages : 232
Taille : 43,0 Ko

Et ce que je voudrait, c'est qu'elle s'affiche ici :
Nom : MonJFrame.JPG
Affichages : 216
Taille : 49,1 Ko

Mais je ne sais pas comment m'y prendre si quelqu'un peut m'orienter vers une solution, ou bien m'aider.
Je tien à rappeler que ma class TestPanel extends JFrame ce voit généré automatiquement car j'utilise JFrameForm pour celui-ci.

Merci pour ceux qui voudront bien m'aider.