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
|
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
public class MainWin extends JFrame {
// objets crees/importes
JPanel panContainer= new JPanel();
JPanel panNorth= new JPanel();
JPanel panCenter= new JPanel();
JPanel panSouth= new JPanel();
JPanel panEast= new JPanel();
JPanel panWest= new JPanel();
JLabel lblAfficheNom= new JLabel();
JLabel lblNom= new JLabel();
Humain h01= new Humain();
Btn btn= new Btn();
// variables
// constructeur
public MainWin() {
this.setSize(800, 822);
this.setTitle("");
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//-----
this.setContentPane(panContainer);
this.setLayout(new BorderLayout());
//-----
this.getContentPane().add(panNorth, BorderLayout.NORTH);
this.getContentPane().add(panCenter, BorderLayout.CENTER);
this.getContentPane().add(panSouth, BorderLayout.SOUTH);
this.getContentPane().add(panEast, BorderLayout.EAST);
this.getContentPane().add(panWest, BorderLayout.WEST);
panNorth.setBackground(Color.black);
panCenter.setBackground(Color.white);
panSouth.setBackground(Color.black);
panEast.setBackground(Color.black);
panWest.setBackground(Color.black);
//-----
panCenter.setLayout(new GridLayout(1, 2));
lblAfficheNom.setText("affiche le nom");
panCenter.add(lblAfficheNom);
panCenter.add(lblNom);
panCenter.add(btn);
//-----
//JOptionPane.showMessageDialog(null, "alert", "alert", JOptionPane.ERROR_MESSAGE);
//JOptionPane.showInternalMessageDialog(panCenter, "information", "information", JOptionPane.INFORMATION_MESSAGE);
//JOptionPane.showConfirmDialog(null, "choose one", "choose one", JOptionPane.YES_NO_OPTION);
this.setVisible(true);
}
} |
Partager