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
|
public class MenuP extends JFrame implements ActionListener{
// declaration d'un panneaau
private JPanel pan= new JPanel();
private JPanel panSysy = new JPanel();
private JPanel panDuffy = new JPanel();
private JPanel panDavid = new JPanel();
private JPanel panChrist = new JPanel();
// declaration d'une police de caractère
private Font police = new Font("Times New Roman",Font.BOLD,20);
private Font police1 = new Font("Times New Roman",Font.BOLD,14);
// declaration des labels
private JLabel duffy = new JLabel("GESTION DE BUDGET");
private JLabel david = new JLabel("GESTION ENGAGEMENTS");
private JLabel christ = new JLabel("INITIALISATION DONNEES");
private JLabel sysy = new JLabel("MENU DE GESTION");
// declaration d'un Container
Container contenu = new Container();
// declaration des bouton
private JButton imports = new JButton("Importer");
private JButton quit = new JButton("Quitter");
private JButton BD = new JButton();
private JButton EG = new JButton();
private JButton zero = new JButton();
public MenuP(){
super();
setTitle("Menu Principal");
setSize(300,350);
setLocationRelativeTo(null);
pan.setBackground(Color.lightGray);
panSysy.setBackground(Color.WHITE);
contenu = getContentPane();
contenu.add(pan);
pan.add(panSysy);
pan.add(panDuffy);
pan.add(panDavid);
pan.add(panChrist);
// allocation des polices et des dimention au label
sysy.setFont(police);
sysy.setHorizontalAlignment(JLabel.CENTER);
duffy.setFont(police1);
david.setFont(police1);
christ.setFont(police1);
panSysy.setPreferredSize(new Dimension(250,70));
// coloriage des bordures des panneaux
panSysy.setBorder(BorderFactory.createLineBorder(Color.BLACK));
pan.setBorder(BorderFactory.createLineBorder(Color.BLACK));
panDuffy.setBorder(BorderFactory.createLineBorder(Color.BLACK));
panDavid.setBorder(BorderFactory.createLineBorder(Color.BLACK));
panChrist.setBorder(BorderFactory.createLineBorder(Color.BLACK));
// positionnnement des élements
pan.setLayout(null);
imports.setBounds(80,280,90,25);
quit.setBounds(175,280,90,25);
sysy.setBounds(20,20,240,20);
duffy.setBounds(20,70,180,15);
david.setBounds(20,80,180,15);
christ.setBounds(20,110,180,15);
panSysy.setBounds(20,20,250,30);
panDuffy.setBounds(20,75,180,25);
panDavid.setBounds(20,110,180,25);
panChrist.setBounds(20,150,180,25);
BD.setBounds(210,75,60,25);
EG.setBounds(210,110,60,25);
zero.setBounds(210,150,60,25);
//insertion des boutons
pan.add(imports);
pan.add(quit);
pan.add(BD);
pan.add(EG);
pan.add(zero);
// insertion des Labels
panSysy.add(sysy);
panDuffy.add(duffy);
panDavid.add(david);
panChrist.add(christ);
// placer les écouteurs des boutons
imports.addActionListener(this);
quit.addActionListener(this);
BD.addActionListener(this);
EG.addActionListener(this);
zero.addActionListener(this);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String momo[]){
new MenuP();
}
} |
Partager