IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

[Débutant] Affichage de 2 fenetres simultanées


Sujet :

AWT/Swing Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juin 2007
    Messages : 30
    Par défaut [Débutant] Affichage de 2 fenetres simultanées
    J'ai débuté très recement le developpement sous Java (eclipse) et j'utilise tant bien que mal swing... J'aimerai afficher la Jfram contenue dans la class saisie_numerique au dessus de ce celle contenue dans Login_pass
    et faire un transfert d'info a l'ouverture et a la fermeture de saisie_numerique...
    L'ideal serai que la fenetre login reste en fond lors de l'affichage de l'autre mais soit innactive.
    Je suis bien conscient que ma façon de coder est pas très propre et le tranfert d'info de mot de passe sera optimisé par la suite.

    Les tentative d'appelle d'une classe a l'autre son a nivo de jButton1 et jButton dans le code de login.
    D'autre morceaux de code existent pour stocker les langues ou les parametres graphiques, mais bien que pas definitifs ceux-ci ne semble pas poser de problemes...
    Je peux assez facilement lancer l'une des 2 fenetres mais pas les 2 en meme temps...

    D'avance merci

    Zucco

    voici le code de login:

    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
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
     
    package IHM.Login;
     
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.util.Locale;
    import java.util.ResourceBundle;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.JTextPane;
    import javax.swing.JPasswordField;
    import IHM.Graphical_parameters;
    import javax.swing.JFrame;
     
    public class Login_pass extends JFrame{
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
     
    	private JPanel jPanel = null;
    	private JLabel jLabel = null;
    	private JTextPane jTextPane = null;
    	private JTextPane jTextPane1 = null;
    	private JTextField num_ve = null;
     
    	private JButton Valider = null;
     
    	private JPasswordField jPasswordField = null;
     
    	public static JTextPane login_txt = null;
     
    	public static JTextPane mdp_txt1 = null;
     
    	private JButton French = null;
     
    	private JButton German = null;
     
    	private JButton english = null;
     
    	public Locale currentLocale= new Locale("fr","FR");  //  @jve:decl-index=0:
     
    	public ResourceBundle messages;
     
    	private JButton jButton = null;  //  @jve:decl-index=0:visual-constraint="445,445"
     
    	private JButton jButton1 = null;  //  @jve:decl-index=0:visual-constraint="177,454"
     
    	private void initialize() {    
    		this.setExtendedState(MAXIMIZED_BOTH);
    		this.setUndecorated(true);
    		this.setTitle("Login");
    		this.setContentPane(getJPanel());
    		this.setSize(new Dimension(428, 212));
    		this.setVisible(true);
    	}
    	public Login_pass(){
    		super();
    		initialize();	
    	}
    	public static void main(String[] args){
    		Login_pass ste = new Login_pass();
    		ste.show();
    	}
     
     
    	/**
             * This method initializes jPanel       
             *      
             * @return javax.swing.JPanel   
             */
    	private JPanel getJPanel() {
    		if (jPanel == null) {
    			jLabel = new JLabel();
    			jLabel.setBounds(new Rectangle(1, 2, 132, 32));
    			jLabel.setIcon(new ImageIcon(getClass().getResource("/images.jpg")));
    			jLabel.setText("");
    			jPanel = new JPanel();
    			jPanel.setLayout(null);
    			jPanel.setBackground(new Color(Graphical_parameters.bg_r, Graphical_parameters.bg_g, Graphical_parameters.bg_b));
    			jPanel.setToolTipText("");
    			jPanel.add(jLabel, null);
    			jPanel.add(getJTextPane(), null);
    			jPanel.add(getJTextPane1(), null);
    			jPanel.add(getNum_ve(), null);
    			jPanel.add(getValider(), null);
    			jPanel.add(getJPasswordField(), null);
    			jPanel.add(getLogin_txt(), null);
    			jPanel.add(getMdp_txt1(), null);
    			jPanel.add(getFrench(), null);
    			jPanel.add(getGerman(), null);
    			jPanel.add(getEnglish(), null);
    			jPanel.add(getJButton(), null);
    			jPanel.add(getJButton1(), null);
    		}
    		return jPanel;
    	}
    	/**
             * This method initializes jTextPane    
             *      
             * @return javax.swing.JTextPane        
             */
    	private JTextPane getJTextPane() {
    		if (jTextPane == null) {
    			jTextPane = new JTextPane();
    			jTextPane.setForeground(new Color(Graphical_parameters.Title_r, Graphical_parameters.Title_g, Graphical_parameters.Title_b));
    			jTextPane.setFont(new Font(Graphical_parameters.Title_type, Graphical_parameters.Title_style, Graphical_parameters.Title_size));
    			jTextPane.setText("Saisie de l'utilisateur");
    			jTextPane.setLocation(new Point(225, 9));
    			jTextPane.setSize(new Dimension(Graphical_parameters.Title_pansize_h, Graphical_parameters.Title_pansize_v));
    			jTextPane.setEditable(false);
    			jTextPane.setBackground(new Color(Graphical_parameters.bg_r, Graphical_parameters.bg_g, Graphical_parameters.bg_b));
    		}
    		return jTextPane;
    	}
    	/**
             * This method initializes jTextPane1   
             *      
             * @return javax.swing.JTextPane        
             */
    	private JTextPane getJTextPane1() {
    		if (jTextPane1 == null) {
    			jTextPane1 = new JTextPane();
    			jTextPane1.setFont(new Font("Dialog", Font.PLAIN, 12));
    			jTextPane1.setForeground(Color.darkGray);
    			jTextPane1.setText(" Utilisateur non connecté");
    			jTextPane1.setEditable(false);
    			jTextPane1.setPreferredSize(new Dimension(142, 60));
    			jTextPane1.setLocation(new Point(3, 51));
    			jTextPane1.setSize(new Dimension(90, 90));
    			jTextPane1.setBackground(new Color(Graphical_parameters.bg_r, Graphical_parameters.bg_g, Graphical_parameters.bg_b));
    		}
    		return jTextPane1;
    	}
    	/**
             * This method initializes num_ve       
             *      
             * @return javax.swing.JTextField       
             */
    	public JTextField getNum_ve() {
    		if (num_ve == null) {
    			num_ve = new JTextField();
    			num_ve.setLocation(new Point(125, 120));
    			num_ve.setFont(new Font("Dialog", Font.BOLD, 18));
    			num_ve.setEditable(true);
    			num_ve.setSize(new Dimension(240, 30));
    		}
    		return num_ve;
    	}
    	/**
             * This method initializes Valider      
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getValider() {
    		if (Valider == null) {
    			Valider = new JButton();
    			Valider.setLocation(new Point(285, 240));
    			Valider.setFont(new Font("Dialog", Font.BOLD, 18));
    			Valider.setText("Valider");
    			Valider.setSize(new Dimension(120, 40));
    		}
    		return Valider;
    	}
    	/**
             * This method initializes jPasswordField       
             *      
             * @return javax.swing.JPasswordField   
             */
    	public JPasswordField getJPasswordField() {
    		if (jPasswordField == null) {
    			jPasswordField = new JPasswordField();
    			jPasswordField.setEchoChar('*');
    			jPasswordField.setFont(new Font("Dialog", Font.BOLD, 18));
    			jPasswordField.setLocation(new Point(125, 185));
    			jPasswordField.setSize(new Dimension(240, 30));
    			jPasswordField.setBorder(null);
    		}
    		return jPasswordField;
    	}
    	/**
             * This method initializes login_txt    
             *      
             * @return javax.swing.JTextPane        
             */
    	private JTextPane getLogin_txt() {
    		if (login_txt == null) {
    			login_txt = new JTextPane();
    			login_txt.setFont(new Font("Dialog", Font.PLAIN, 12));
    			login_txt.setForeground(Color.darkGray);
    			login_txt.setText("Login :");
    			login_txt.setSize(new Dimension(80, 20));
    			login_txt.setLocation(new Point(130, 95));
    			login_txt.setEditable(false);
    			login_txt.setBackground(new Color(145, 210, 225));
    		}
    		return login_txt;
    	}
    	/**
             * This method initializes mdp_txt1     
             *      
             * @return javax.swing.JTextPane        
             */
    	private JTextPane getMdp_txt1() {
    		if (mdp_txt1 == null) {
    			mdp_txt1 = new JTextPane();
    			mdp_txt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    			mdp_txt1.setForeground(Color.darkGray);
    			mdp_txt1.setText("Password :");
    			mdp_txt1.setSize(new Dimension(110, 20));
    			mdp_txt1.setLocation(new Point(130, 160));
    			mdp_txt1.setEditable(false);
    			mdp_txt1.setBackground(new Color(145, 210, 225));
    		}
    		return mdp_txt1;
    	}
    	/**
             * This method initializes French       
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getFrench() {
    		if (French == null) {
    			French = new JButton();
    			French.setLocation(new Point(20, 250));
    			French.setIcon(new ImageIcon(getClass().getResource("/IHM/Login/FranceOK.jpg")));
    			French.setSize(new Dimension(50, 40));
    			French.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					currentLocale = new Locale("fr","FR");
    					 messages = ResourceBundle.getBundle("IHM.Login.MessagesBundle", currentLocale);
    					 mdp_txt1.setText(messages.getString("mdp"));
    					 login_txt.setText(messages.getString("log"));
    					 jTextPane.setText(messages.getString("Titre"));
    					 jTextPane1.setText(messages.getString("connect"));				 
    					 Valider.setText(messages.getString("Valider"));
     
    				}
    			});
    		}
    		return French;
    	}
    	/**
             * This method initializes German       
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getGerman() {
    		if (German == null) {
    			German = new JButton();
    			German.setLocation(new Point(90, 250));
    			German.setIcon(new ImageIcon(getClass().getResource("/IHM/Login/allemagneOK.gif")));
    			German.setSize(new Dimension(50, 40));
    			German.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					currentLocale = new Locale("de","DE");
    					 messages = ResourceBundle.getBundle("IHM.Login.MessagesBundle", currentLocale);
    					 mdp_txt1.setText(messages.getString("mdp"));
    					 login_txt.setText(messages.getString("log"));
    					 jTextPane.setText(messages.getString("Titre"));
    					 jTextPane1.setText(messages.getString("connect"));				 
    					 Valider.setText(messages.getString("Valider"));
     
    				}
    			});
    		}
    		return German;
    	}
    	/**
             * This method initializes english      
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getEnglish() {
    		if (english == null) {
    			english = new JButton();
    			english.setLocation(new Point(160, 250));
    			english.setIcon(new ImageIcon(getClass().getResource("/IHM/Login/DrapeauUsaOK.gif")));
    			english.setSize(new Dimension(50, 40));
    			english.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					currentLocale = new Locale("en","US");
    					 messages = ResourceBundle.getBundle("IHM.Login.MessagesBundle", currentLocale);
    					 mdp_txt1.setText(messages.getString("mdp"));
    					 login_txt.setText(messages.getString("log"));
    					 jTextPane.setText(messages.getString("Titre"));
    					 jTextPane1.setText(messages.getString("connect"));				 
    					 Valider.setText(messages.getString("Valider"));
     
    				}
    			});
    		}
    		return english;
    	}
    	/**
             * This method initializes jButton      
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton() {
    		if (jButton == null) {
    			jButton = new JButton();
    			jButton.setSize(new Dimension(240, 60));
    			jButton.setLocation(new Point(125, 120));
    			jButton.setVisible(true);
    			jButton.addActionListener(new java.awt.event.ActionListener() {
    			public void actionPerformed(java.awt.event.ActionEvent e) {
    				IHM.Input_Ouput.pop_string=num_ve.getText();
     
    				 //Popup(null,IHM.pop_up.Saisie_numerique.jPanel,100,100);
    				IHM.pop_up.Saisie_numerique.main(null);
    			}
    		});
    		}
    		return jButton;
    	}
    	/**
             * This method initializes jButton1     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton1() {
    		if (jButton1 == null) {
    			jButton1 = new JButton();
    			jButton1.setSize(new Dimension(240, 60));
    			jButton1.setLocation(new Point(125, 185));
    			jButton1.setVisible(true);
    			jButton1.addActionListener(new java.awt.event.ActionListener() {
    			public void actionPerformed(java.awt.event.ActionEvent e) {
    				IHM.Input_Ouput.pop_string=jPasswordField.getText();
    				IHM.pop_up.Saisie_numerique.main(null);
    			}
    		});
    		}
    		return jButton1;
    	}
     
    }  //  @jve:decl-index=0:visual-constraint="31,62"
    celui de saisie:

    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
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
     
    package IHM.pop_up;
     
     
     
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.Point;
    import java.awt.Rectangle;
    import javax.swing.JButton;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.JFrame;
     
    public class Saisie_numerique extends JFrame {
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	public JPanel jPanel = null;
    	private JTextField jTextField = null;
    	private JButton jButton = null;
    	private JButton jButton1 = null;
    	private JButton jButton2 = null;
    	private JButton jButton3 = null;
    	private JButton jButton4 = null;
    	private JButton jButton5 = null;
    	private JButton jButton6 = null;
    	private JButton jButton7 = null;
    	private JButton jButton8 = null;
    	private JButton jButton9 = null;
    	private JButton jButton10 = null;
    	private JButton jButton11 = null;
    	private String chaine;
     
    	private void initialize() {    
    	//	jTextField.setText(IHM.Input_Ouput.pop_string);
    		this.setSize(new Dimension(380, 220));
    		this.setContentPane(getJPanel());
    		this.setUndecorated(true);
    		//jTextField.setText(IHM.Login.Login_pass.mdp_txt1.getText());
    	}
     
    	/**
             * This method initializes 
             * 
             */
    	public Saisie_numerique() {
    		//int state = (getJPanel()).showOpenDialog(this);
    		initialize();
    	}
     
     
    	public static void main(String[] args){
    		Saisie_numerique ste = new Saisie_numerique();
    		ste.show();
    	}
     
    	/**
             * This method initializes jPanel       
             *      
             * @return javax.swing.JPanel   
             */
    		public  JPanel getJPanel() {
    		if (jPanel == null) {
    			jPanel = new JPanel();
    			jPanel.setLayout(null);
    			jPanel.setBounds(new Rectangle(44, -38, 372, 276));
    			jPanel.add(getJTextField(), null);
    			jPanel.add(getJButton(), null);
    			jPanel.add(getJButton1(), null);
    			jPanel.add(getJButton2(), null);
    			jPanel.add(getJButton3(), null);
    			jPanel.add(getJButton4(), null);
    			jPanel.add(getJButton5(), null);
    			jPanel.add(getJButton6(), null);
    			jPanel.add(getJButton7(), null);
    			jPanel.add(getJButton8(), null);
    			jPanel.add(getJButton9(), null);
    			jPanel.add(getJButton10(), null);
    			jPanel.add(getJButton11(), null);
    			jPanel.add(getJButton1(), null);
    			jPanel.add(getJButton4(), null);
    			jPanel.add(getJButton1(), null);
    			jPanel.add(getJButton4(), null);
    		}
    		return jPanel;
    	}
    	/**
             * This method initializes jTextField   
             *      
             * @return javax.swing.JTextField       
             */
    	private JTextField getJTextField() {
    		if (jTextField == null) {
    			jTextField = new JTextField();
    			jTextField.setBounds(new Rectangle(15, 10, 240, 30));
    		}
    		return jTextField;
    	}
     
    	/**
             * This method initializes jButton      
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton1() {
    		if (jButton1 == null) {
    			jButton1 = new JButton();
    			jButton1.setText("1");
    			jButton1.setBounds(new Rectangle(15, 50, 70, 30));
    			jButton1.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"1");
    				}
    			});
    		}
    		return jButton1;
    	}
     
    	/**
             * This method initializes jButton1     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton2() {
    		if (jButton2 == null) {
    			jButton2 = new JButton();
    			jButton2.setLocation(new Point(100, 50));
    			jButton2.setText("2");
    			jButton2.setSize(new Dimension(70, 30));
    			jButton2.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"2");
    				}
    			});
    		}
    		return jButton2;
    	}
     
    	/**
             * This method initializes jButton2     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton3() {
    		if (jButton3 == null) {
    			jButton3 = new JButton();
    			jButton3.setSize(new Dimension(70, 30));
    			jButton3.setText("3");
    			jButton3.setLocation(new Point(185, 50));
    			jButton3.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"3");
    				}
    			});
    		}
    		return jButton3;
    	}
     
    	/**
             * This method initializes jButton3     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton4() {
    		if (jButton4 == null) {
    			jButton4 = new JButton();
    			jButton4.setText("4");
    			jButton4.setBounds(new Rectangle(15, 95, 70, 30));
    			jButton4.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"4");
    				}
    			});
    		}
    		return jButton4;
    	}
     
    	/**
             * This method initializes jButton4     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton5() {
    		if (jButton5 == null) {
    			jButton5 = new JButton();
    			jButton5.setLocation(new Point(100, 95));
    			jButton5.setText("5");
    			jButton5.setSize(new Dimension(70, 30));
    			jButton5.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"5");
    				}
    			});
    		}
    		return jButton5;
    	}
     
    	/**
             * This method initializes jButton5     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton6() {
    		if (jButton6 == null) {
    			jButton6 = new JButton();
    			jButton6.setLocation(new Point(185, 95));
    			jButton6.setText("6");
    			jButton6.setSize(new Dimension(70, 30));
    			jButton6.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"6");
    				}
    			});
    		}
    		return jButton6;
    	}
     
    	/**
             * This method initializes jButton6     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton7() {
    		if (jButton7 == null) {
    			jButton7 = new JButton();
    			jButton7.setBounds(new Rectangle(15, 140, 70, 30));
    			jButton7.setText("7");
    			jButton7.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"7");
    				}
    			});
    		}
    		return jButton7;
    	}
     
    	/**
             * This method initializes jButton7     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton8() {
    		if (jButton8 == null) {
    			jButton8 = new JButton();
    			jButton8.setBounds(new Rectangle(100, 140, 70, 30));
    			jButton8.setText("8");
    			jButton8.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"8");
    				}
    			});
    		}
    		return jButton8;
    	}
     
    	/**
             * This method initializes jButton8     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton9() {
    		if (jButton9 == null) {
    			jButton9 = new JButton();
    			jButton9.setBounds(new Rectangle(185, 140, 70, 30));
    			jButton9.setText("9");
    			jButton9.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"9");
    				}
    			});
    		}
    		return jButton9;
    	}
     
    	/**
             * This method initializes jButton9     
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton10() {
    		if (jButton10 == null) {
    			jButton10 = new JButton();
    			jButton10.setBounds(new Rectangle(270, 10, 70, 30));
    			jButton10.setText("Return");
    			jButton10.setFont(new Font("Dialog", Font.BOLD, 10));
    			jButton10.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					chaine = jTextField.getText();
    					jTextField.setText(	chaine.substring(0,chaine.length()-1));
    				}
    			});
    		}
    		return jButton10;
    	}
     
    	/**
             * This method initializes jButton10    
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton() {
    		if (jButton == null) {
    			jButton = new JButton();
    			jButton.setBounds(new Rectangle(270, 140, 70, 30));
    			jButton.setText("0");
    			jButton.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
    					jTextField.setText(jTextField.getText()+"0");
    				}
    			});	 
    		}
    		return jButton;
    	}
     
    	/**
             * This method initializes jButton11    
             *      
             * @return javax.swing.JButton  
             */
    	private JButton getJButton11() {
    		if (jButton11 == null) {
    			jButton11 = new JButton();
    			jButton11.setBounds(new Rectangle(270, 50, 70, 75));
    			jButton11.setFont(new Font("Dialog", Font.BOLD, 10));
    			jButton11.setText("Valider");
    			jButton11.addActionListener(new java.awt.event.ActionListener() {
    				public void actionPerformed(java.awt.event.ActionEvent e) {
     
    				}
    			});
    			//IHM.Login.Login_pass.mdp_txt1.getText();
    		}
    		return jButton11;
    	}
    }

  2. #2
    Membre éclairé
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    72
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations forums :
    Inscription : Juillet 2006
    Messages : 72
    Par défaut
    Salut,

    je pense que tu devrait utiliser un jdialog :
    http://prevert.upmf-grenoble.fr/Prog...g/JDialog.html

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juin 2007
    Messages : 30
    Par défaut
    Bon avec une JDialog la fenetre s'affiche...Mais pour la communication entre les 2 c'est pas encore ça

    Zucco

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juin 2007
    Messages : 30
    Par défaut
    Bon j'arrive a passer les infos de l'une a l'autre... Oui remplir le champs avant de le creer c'est pas tres intelligent!

    Cela-dit je ne sais toujours pas comment me debrouiller pour empecher l'acces de la fenetre login lorsque saisie est affichée.
    Si non je me doute que c'est facile mais comment on centre une JDialog? (au pire je trouverai tout seul )

    Zucco

  5. #5
    Membre chevronné
    Avatar de Orian
    Inscrit en
    Août 2006
    Messages
    372
    Détails du profil
    Informations personnelles :
    Âge : 36

    Informations forums :
    Inscription : Août 2006
    Messages : 372
    Par défaut
    Pour centrer :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    tondialog.setLocationRelativeTo(null);
    En fait null fait qu'il centre sur l'écran mais tu peut le centrer par rapport à ce que tu veux.

    Et pourquoi ne pas cacher le dialog login avec un :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    tondialogu.setVisible(false);
    Avec un instruction conditionnel pour vérifier que saisie est affiché :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    if (saisie.isVisible()){
    //le tralala
    }
    ou un FocusListenner?

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Juin 2007
    Messages
    30
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Juin 2007
    Messages : 30
    Par défaut
    Merci a tous, le truc pour centrer est parfait.
    Mettre visible a false ne me plait pas trop (c'est trop moche)...
    Et je compends pas trop comment utiliser(me dit que ce que je lui montre doit etre static):
    if (saisie.isVisible()){ //le tralala }

    Un FocusListenner ne convient je crois pas tres bien vu que la machine utilisée n'a pas de clavier...

    Le truc c'est que j'aimerai endormir le processus appellant tant que l'appelé est actif. Sachant que l'appelant ne sera pas toujours la meme classe...
    Engros faire un mecanisme sychrone et pouvoir continuerune serie d'instruction une fois l'appelé fermé.

    Zucco

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. (débutante)affichage une autre fenetre
    Par sanaa16 dans le forum AWT/Swing
    Réponses: 1
    Dernier message: 01/01/2008, 13h34
  2. (débutant) aFfichage d'une fenetre en attente
    Par Asnidren dans le forum Entrée/Sortie
    Réponses: 3
    Dernier message: 17/10/2006, 11h32
  3. [Débutant] Affichage d'une grille
    Par Mathieu.J dans le forum OpenGL
    Réponses: 25
    Dernier message: 13/06/2004, 19h38
  4. [QuickReport][Débutant] Affichage d'un graphique
    Par poufouille dans le forum Bases de données
    Réponses: 3
    Dernier message: 23/03/2004, 09h03
  5. [Débutant] Affichage impossible en local
    Par Alberto dans le forum ASP
    Réponses: 2
    Dernier message: 29/11/2003, 16h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo