| 12
 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
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 
 | /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
package clientmsn;
 
/**
 *
 * @author zoners
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagLayout;
 
 
 
/**
 *
 * @author zoners
 */
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextField;
 
public class Acceuil extends JFrame
{
    private JButton bouton;
    private JButton bouton2;
    private JLabel label;
    private JTextField loginField;
    private JTextField passwordField;
 
	public Acceuil()
        {
		super();
		build();//On initialise notre fenêtre
	}
 
	private void build(){
		setTitle("Client msn CoRed"); //On donne un titre à l'application
		setSize(850,700); //On donne une taille à notre fenêtre
		setLocationRelativeTo(null); //On centre la fenêtre sur l'écran
		setResizable(false); //On interdit la redimensionnement de la fenêtre
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //On dit à l'application de se fermer lors du clic sur la croix
                this.setContentPane(buildContentPane());
        }
	//...
 
	private JPanel buildContentPane()
        {
            //Menu
            MenuAction menuAction = new MenuAction();
            JMenuBar menuBar = new JMenuBar();
            JMenu menu1 = new JMenu("Fichier");
 
            JMenuItem menu11 = new JMenuItem("menu1");
            menu11.addActionListener(menuAction.menu1);
            menu1.add(menu11);
 
            JMenuItem menu12 = new JMenuItem("menu2");
            menu12.addActionListener(menuAction.menu2);
            menu1.add(menu12);
 
            menuBar.add(menu1);
 
            JMenu menu2 = new JMenu("?");
            JMenuItem aPropos = new JMenuItem("A propos");
            aPropos.addActionListener(menuAction.menu3);
            menu2.add(aPropos);
            menuBar.add(menu2);
 
            JMenuItem menu21 = new JMenuItem("menu4");
            menu21.addActionListener(menuAction.menu4);
            menu2.add(menu21);
            menuBar.add(menu2);
            setJMenuBar(menuBar);
            //FIN MENU
            JPanel panelPrincipal = new JPanel();
            panelPrincipal.setLayout(new GridBagLayout());
 
 
            Logo logo=new Logo();
            GridBagConstraints cLogo = new GridBagConstraints();
            cLogo.gridheight=1;
            cLogo.gridwidth=1;
            cLogo.gridx=0;
            cLogo.gridy=0;
            cLogo.weightx=1;
            cLogo.weighty=1;
            cLogo.insets=new Insets(140,350,20,350);
            cLogo.fill=GridBagConstraints.BOTH;
            panelPrincipal.add(logo,cLogo);
 
            JLabel login=new JLabel("Login");
          GridBagConstraints cLogin = new GridBagConstraints();
            cLogin.gridheight=1;
            cLogin.gridwidth=1;
            cLogin.gridx=0;
            cLogin.gridy=1;
            cLogin.insets=new Insets(-700,0,0,50);
            panelPrincipal.add(login,cLogin);
 
            JLabel password=new JLabel("Password");
            GridBagConstraints cPassword = new GridBagConstraints();
            cPassword.gridx=0;
            cPassword.gridy=2;
            panelPrincipal.add(password,cPassword);
 
            loginField = new JTextField("Taper ici votre login");
            loginField.setColumns(30);
            GridBagConstraints cLoginField = new GridBagConstraints();
             cLoginField.gridheight=1;
             cLoginField.gridwidth=GridBagConstraints.REMAINDER;
            cLoginField.gridx=2;
            cLoginField.gridy=1;
            cLoginField.insets=new Insets(-700,-300,0,0);
            panelPrincipal.add(loginField,cLoginField);
 
            passwordField = new JTextField("Taper ici votre mot de passe");
            GridBagConstraints cPasswordField = new GridBagConstraints();
	    cPasswordField.gridx=2;
            cPasswordField.gridy=2;
            panelPrincipal.add(passwordField,cPasswordField);
 
 
            JLabel nouveauCompte=new JLabel("Nouveau Compte");
            GridBagConstraints cNouveauCompte = new GridBagConstraints();
            cNouveauCompte.gridx=2;
            panelPrincipal.add(nouveauCompte,cNouveauCompte);
 
            JLabel seConnecter=new JLabel("Se Connecter");
            GridBagConstraints cSeConnecter = new GridBagConstraints();
            cSeConnecter.gridx=3;
            cSeConnecter.gridy=3;
            panelPrincipal.add(seConnecter,cSeConnecter);
 
            Banniere banniere=new Banniere();
            GridBagConstraints cBanniere = new GridBagConstraints();
            cBanniere.gridx=3;
            cBanniere.gridy=0;
            panelPrincipal.add(banniere,cBanniere);
 
 
		return panelPrincipal;
	}
 
 
        class BoutonListener implements ActionListener
        {
            public void actionPerformed(ActionEvent e)
            {
                label.setText("Résultat : Pas encore calculé");
 
            }
        }
        public JTextField getField1(){
		return loginField;
	}
 
	public JTextField getField2(){
		return passwordField;
	}
 
} | 
Partager