Bonjour,

J'ai pour objectif de créer une application en java avec une fenêtre principale et des fenêtres filles comme cela se fait avec Microsoft VB.
J'ai bien du mal et je vous donne mon code afin de que vous m'aidiez si possible.

Le MDI Container (comme en VB) avec un menu qui me permet d'afficher les MDI child
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
 
package principal;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JRootPane;
 
import formulaires.FrmNouveauContact;
import java.awt.*;
import java.awt.event.*;
 
public class FormAccueil extends JFrame {
	private JMenuBar barre = new JMenuBar();
	private JMenu Menu = new JMenu("Menu");
	private JMenuItem NouveauContact = new JMenuItem("Nouveau contact");
	private JMenuItem Quitter = new JMenuItem("Quitter");
	/**
         * 
         */
	private static final long serialVersionUID = 1L;
 
	/**
         * @param args
         */
	public FormAccueil() {
 
		final JDesktopPane desktopPane = new JDesktopPane();
		desktopPane.setBackground(Color.gray);
		JPanel contentPane = (JPanel)this.getContentPane();
		contentPane.add(desktopPane, BorderLayout.CENTER);
		setJMenuBar(barre);
		barre.add(Menu);
		Menu.add(NouveauContact);
		Menu.add(Quitter);
 
 
		///////////////////////////////////////////////////////////////
		// TODO Menu quitter
		Quitter.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				dispose();
				System.exit(0);
			}
		});
	/////////////////////////////////////////////////////////////////
	//TODO Programme NouveauContact
	NouveauContact.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent evt) {
			FrmNouveauContact Contact = new FrmNouveauContact();
			desktopPane.add(NouveauContact);
			Contact.setSize(400,200);
			//Contact.setModalExclusionType(null);
			Contact.setDefaultCloseOperation(EXIT_ON_CLOSE);
			Contact.setResizable(false);
			Contact.setVisible(true);
		}
 
	});
 
 
}
 
 
 
	//TODO Programme principal	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
 
		FormAccueil Fen = new FormAccueil();
		// TODO Auto-generated method stub
		Fen.setSize(800, 500);
		// TODO Auto-generated method stub
		Fen.setDefaultCloseOperation(EXIT_ON_CLOSE);
		// TODO Afficher le formulaire
		Fen.setVisible(true);
 
	}
 
}
un MDI child
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
 
 
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
 
import javax.swing.JButton;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
//import actions.ActionAjouter;
public class FrmNouveauContact extends JInternalFrame {
	/**
         * 
         */
	static final int xPosition = 30, yPosition=30;
	private static final long serialVersionUID = 1L;
	// TODO Déclaration de variables
	private JLabel lblNom;
	private JTextField txtNom;
	private JLabel lblContact;
	private JTextField txtContact;
	private JButton btnAjout;
	// TODO Constructeur de la fenêtre FormContact
	public FrmNouveauContact() {
		// TODO Création d'un conteneur de type panel
		super();
		this.setLayout(null);
 
		//JPanel p1= new JPanel(); 
		//JPanel p2= new JPanel(); 
		//p1.setLayout(null);
		//panneau.add(p);
 
 
		//p1.setLayout( new GridLayout(2,2));
		//p.setLayout(new BorderLayout(5, 5));
		// TODO Création des labels et zones de texte
 
		lblNom = new JLabel("Nom :");
 
		lblNom.setDisplayedMnemonic('N');
		lblContact = new JLabel("Contact :");
		txtNom = new JTextField();
		txtNom.setColumns(20);
		txtContact = new JTextField();
		txtContact.setColumns(15);
 
		btnAjout = new JButton("AJOUTER");
		// TODO Ajout d'éléments sur le conteneur
 
		//p1.add(lblNom,BorderLayout.NORTH);
		this.add(lblNom);
 
		this.getContentPane().add(txtNom);
		this.getContentPane().add(lblContact);
		this.getContentPane().add(txtContact);
		this.getContentPane().add(btnAjout);
		lblNom.setBounds(50, 50, 60, 25);
		txtNom.setBounds(120, 50, 200, 25);
		lblContact.setBounds(50, 80, 60, 25);
		txtContact.setBounds(120, 80, 150, 25);
		btnAjout.setBounds(120, 120, 100, 25);
		pack();
		//btnAjout.addActionListener(new ActionAjouter());
		// TODO Modifier la taille de la fenêtre
		setSize(400, 200);
		// TODO Donner un titre à la fenêtre
		setTitle("Contacta");
		// TODO Empêcher le redimensionnement de la fenêtre
		setResizable(false);
 
		// TODO Centrer la fenêtre par à l'écran de l'ordi
		//setLocationRelativeTo(null);
		//setLocation(xPosition, yPosition);
	}
 
}
Je vous remercie d'avance de me donner un coup de main.