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

Agents de placement/Fenêtres Java Discussion :

Problème de JFrame vide


Sujet :

Agents de placement/Fenêtres Java

  1. #1
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut Problème de JFrame vide
    Bonjour, j'espère ne pas polluer le forum avec ce post... mais j'ai recherché avant et rien...

    J'ai une classe qui extends JFrame(1), une autre classe(2) qui comporte 2 constructeurs appelant (1), et une dernière classe (3) pour authentifier qui extends JFrame.

    En gros ca fait ca : (ne pas tenir compte des points dans le schéma)
    ...........___(2)____
    OK...../.................\
    ..........................(1)
    NOK...\................./
    .............(3).->.(2)

    Mon pbm : Quand tout est OK, la Frame en (1) s'affiche normalement, Quand c'est NOK, la Frame (1) s'affiche mais elle est vide

    NB: Toutes mes Frames sont Threadées


    Si vous pouvez m'eclairer... merci

  2. #2
    Membre éprouvé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Janvier 2007
    Messages
    697
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : France, Calvados (Basse Normandie)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Janvier 2007
    Messages : 697
    Points : 1 241
    Points
    1 241
    Par défaut
    Si tu pouvais poster ton code...

  3. #3
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut
    Voila le code de la fenetre d'attente (1)

    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
    public class WaitFrame extends javax.swing.JFrame implements Runnable {
     
        /**
             * 
             */
    	private static final long serialVersionUID = 3868697665963167148L;
    	private Thread thread;
     
    	/** Creates new form Info */
        public WaitFrame() {
            this.thread = new Thread(this);
            thread.start();
            //initComponents();
        }
     
        public void run() {
        	initComponents();
        }
     
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jPanel1 = new GradientPanel( Color.BLACK, Color.GRAY );
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
     
            try {
            	InputStream is1 = getClass().getResourceAsStream("/artwork/phone.png");
            	//BufferedImage bi = ImageIO.read( new File("artwork/phone.png") );
    			BufferedImage bi = ImageIO.read(is1);
            	ImageIcon ii = new ImageIcon(bi);
    			jLabel2.setIcon(ii);
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
     
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Connexion");
            jLabel1.setFont(new java.awt.Font("Dialog", 1, 24));
            jLabel1.setForeground(new java.awt.Color(204, 204, 204));
            jLabel1.setText("Connexion avec le serveur");
     
            jLabel3.setForeground(new java.awt.Color(204, 204, 204));
            jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
     
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(116, 116, 116)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE))))
                    .addContainerGap())
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(35, 35, 35)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            );
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
            pack();
     
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            this.setLocation((screen.width - this.getSize().width)/2,(screen.height - this.getSize().height)/2); 
     
     
            this.setVisible(true);
     
     
        }// </editor-fold>
     
     
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JPanel jPanel1;
        // End of variables declaration
    	synchronized public void addText( String txt ) {
    		jLabel3.setText(txt);
    	}
     
    }

    Voila le code de celle qui appelle la frame 1 : (2) les 2 constructeurs

    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
    public class CiscoLib {
     
    	//ConfigLoader
    	private Configure conf; 
    	//Identification
    	private String ccmAddress	  = null;
    	private String login		  = null;
    	private String password		  = null;
    	private String dialingNumber  = null;
    	//Provider
    	private CiscoJtapiPeer myJtapiPeer;
    	private CiscoProvider myProvider;
    	//Ressources Utilisateur 
    	//private Address[]  myAddresses;
    	private Terminal[] myTerminals;
    	private CiscoAddress myAddress;
    	public CiscoTerminal myTerminal;
    	//Appels
    	private CiscoCall myCiscoCall;
    	//Fenetre
    	protected WaitFrame waitFrame;
     
     
    	/************************************************************************/
    	public CiscoLib(){
    		waitFrame = new WaitFrame();
     
    		try {
    			Thread.sleep(500);
    		} catch (InterruptedException e1) {
    			e1.printStackTrace();
    		}
     
    		waitFrame.addText("Récupération de la configuration");
     
    		//init
    		try {
    			conf = new Configure();
    			Thread.sleep(1000);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		this.ccmAddress = conf.getCcm();
    		this.login = conf.getLogin();
    		this.dialingNumber = conf.getDn();
    		this.password = conf.getPwd();
     
    		connectToProvider();
    		getRessources();
    		setAddress();
    		setTerminal();
    		try {
    			Thread.sleep(1000);
    			waitFrame.addText("Lancement de l'interface...");
    			Thread.sleep(2000);
    			waitFrame.dispose();
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
    		new SoftDialerFrame(this).setVisible(true);
    	}
     
     
     
    	public CiscoLib(String user, String pwd, String line, String ccm){
     
    		this.ccmAddress = ccm;
    		this.login = user;
    		this.dialingNumber = line;
    		this.password = pwd;
     
    		/*java.awt.EventQueue.invokeLater(new Runnable() {
    	            public void run() {
    	            	//waitFrame = new WaitFrame();
    	            	//waitFrame.addText("Récupération de la configuration");
    	            }
    		});*/
     
     
    		waitFrame = new WaitFrame();
    		//waitFrame.addText("Récupération de la configuration");
     
    		/*try {
    			EventQueue.invokeAndWait(waitFrame);
    		} catch (Exception e1) {
    			e1.printStackTrace();
    		} */
     
    		//waitFrame.addText("Récupération de la configuration");
     
    		//init
    		try {
    			Thread.sleep(1000);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		waitFrame.addText("Récupération de la configuration");
    		this.ccmAddress = ccm;
    		this.login = user;
    		this.dialingNumber = line;
    		this.password = pwd;
     
    		connectToProvider();
    		getRessources();
    		setAddress();
    		setTerminal();
    		try {
    			Thread.sleep(1000);
    			waitFrame.addText("Lancement de l'interface...");
    			Thread.sleep(2000);
    			waitFrame.dispose();
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
    		new SoftDialerFrame(this).setVisible(true);
    	}

    Et le code de la fenetre d'authentification (3)
    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
    public class AuthentificateFrame extends javax.swing.JFrame implements Runnable{
     
        /**
             * 
             */
    	private static final long serialVersionUID = -8608817706415014581L;
    	private Thread thread;
    	private String ccm, dn, login;
     
     
    	public AuthentificateFrame(String ccm, String dn, String login) {
        	this.ccm = ccm;
        	this.dn = dn;
        	this.login = login;
    		this.thread = new Thread(this);
        	this.thread.start();
    		//initComponents();
        }
     
    	public void run(){
    		initComponents();
    	}
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents(/*String ccm, String dn, String login*/) {
            jPanel1 = new GradientPanel( Color.BLACK, Color.GRAY );
            jTextFieldUser = new javax.swing.JTextField(this.login);
            jPasswordField = new javax.swing.JPasswordField();
            jTextFieldLine = new javax.swing.JTextField(this.dn);
            jTextFieldCCM = new javax.swing.JTextField(this.ccm);
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            jLabel4 = new javax.swing.JLabel();
            jLabel5 = new javax.swing.JLabel();
            jButtonAuth = new PngButton("artwork/keyb.png","artwork/keyh.png");
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
     
            jLabel2.setText("Utilisateur");
            jLabel2.setForeground(new java.awt.Color(204, 204, 204));
            jLabel3.setText("Password");
            jLabel3.setForeground(new java.awt.Color(204, 204, 204));
            jLabel4.setText("Ligne");
            jLabel4.setForeground(new java.awt.Color(204, 204, 204));
            jLabel5.setText("Serveur");
            jLabel5.setForeground(new java.awt.Color(204, 204, 204));
     
            jButtonAuth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonAuthActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(43, 43, 43)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel2)
                                .addComponent(jLabel3)
                                .addComponent(jLabel4)
                                .addComponent(jLabel5))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jPasswordField)
                                .addComponent(jTextFieldUser, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                .addComponent(jTextFieldLine)
                                .addComponent(jTextFieldCCM)))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(82, 82, 82)
                            .addComponent(jButtonAuth, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(88, Short.MAX_VALUE))
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jButtonAuth, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(23, 23, 23)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldCCM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5))
                    .addContainerGap(24, Short.MAX_VALUE))
            );
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            pack();
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            this.setLocation((screen.width - this.getSize().width)/2,(screen.height - this.getSize().height)/2);
            this.setVisible(true);
     
        }// </editor-fold>
     
        private void jButtonAuthActionPerformed(java.awt.event.ActionEvent evt) {
        	this.dispose();
        	try {
    			Thread.sleep(1000);
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
        	new CiscoLib(getJTextFieldUser(), getJPasswordField(), getJTextFieldLine(), getJTextFieldCCM());
    	}
     
     
     
     
        // Variables declaration - do not modify
        private javax.swing.JButton jButtonAuth;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPasswordField jPasswordField;
        private javax.swing.JTextField jTextFieldCCM;
        private javax.swing.JTextField jTextFieldLine;
        private javax.swing.JTextField jTextFieldUser;
        // End of variables declaration
     
        public String getJPasswordField() {
    		return new String(jPasswordField.getPassword());
    	}
     
    	public String getJTextFieldCCM() {
    		return jTextFieldCCM.getText();
    	}
     
    	public String getJTextFieldLine() {
    		return jTextFieldLine.getText();
    	}
     
    	public String getJTextFieldUser() {
    		return jTextFieldUser.getText();
    	}
     
    }
    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
     
    package pkg_CISCO;
     
    import javax.swing.JOptionPane;
    import javax.swing.SwingUtilities;
    import javax.telephony.JtapiPeerFactory;
    import javax.telephony.Provider;
    import javax.telephony.Terminal;
    import javax.telephony.TerminalConnection;
    import pkg_CONFIG.Configure;
    import pkg_IHM.SoftDialerFrame;
    import pkg_IHM.WaitFrame;
    import com.cisco.jtapi.extensions.CiscoAddress;
    import com.cisco.jtapi.extensions.CiscoCall;
    import com.cisco.jtapi.extensions.CiscoJtapiPeer;
    import com.cisco.jtapi.extensions.CiscoProvider;
    import com.cisco.jtapi.extensions.CiscoTerminal;
     
    public class CiscoLib {
     
    	//ConfigLoader
    	private Configure conf; 
    	//Identification
    	private String ccmAddress	  = null;
    	private String login		  = null;
    	private String password		  = null;
    	private String dialingNumber  = null;
    	//Provider
    	private CiscoJtapiPeer myJtapiPeer;
    	private CiscoProvider myProvider;
    	//Ressources Utilisateur 
    	//private Address[]  myAddresses;
    	private Terminal[] myTerminals;
    	private CiscoAddress myAddress;
    	public CiscoTerminal myTerminal;
    	//Appels
    	private CiscoCall myCiscoCall;
    	//Fenetre
    	private WaitFrame waitFrame;
     
     
    	/************************************************************************/
    	public CiscoLib(){
    		waitFrame = new WaitFrame();
     
    		try {
    			SwingUtilities.invokeAndWait((Runnable) waitFrame);
    		} catch (Exception e2) {
    			e2.printStackTrace();
    		} 
     
    		//waitFrame = new WaitFrame();
     
    		try {
    			Thread.sleep(500);
    		} catch (InterruptedException e1) {
    			e1.printStackTrace();
    		}
     
    		//waitFrame.addText("Récupération de la configuration");
     
    		//init
    		try {
    			conf = new Configure();
    			Thread.sleep(1000);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
    		this.ccmAddress = conf.getCcm();
    		this.login = conf.getLogin();
    		this.dialingNumber = conf.getDn();
    		this.password = conf.getPwd();
     
    		connectToProvider();
    		getRessources();
    		setAddress();
    		setTerminal();
    		try {
    			Thread.sleep(1000);
    			waitFrame.addText("Lancement de l'interface...");
    			Thread.sleep(2000);
    			waitFrame.dispose();
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
    		new SoftDialerFrame(this).setVisible(true);
    	}
     
     
     
    	public CiscoLib(String user, String pwd, String line, String ccm){
     
    		this.ccmAddress = ccm;
    		this.login = user;
    		this.dialingNumber = line;
    		this.password = pwd;
     
    		/*java.awt.EventQueue.invokeLater(new Runnable() {
    	            public void run() {
    	            	//waitFrame = new WaitFrame();
    	            	//waitFrame.addText("Récupération de la configuration");
    	            }
    		});*/
     
     
    		waitFrame = new WaitFrame();
    		//waitFrame.addText("Récupération de la configuration");
     
    		/*try {
    			EventQueue.invokeAndWait(waitFrame);
    		} catch (Exception e1) {
    			e1.printStackTrace();
    		} */
     
    		//waitFrame.addText("Récupération de la configuration");
     
    		//init
    		try {
    			Thread.sleep(1000);
    		} catch (Exception e) {
    			e.printStackTrace();
    		}
     
    		waitFrame.addText("Récupération de la configuration");
    		this.ccmAddress = ccm;
    		this.login = user;
    		this.dialingNumber = line;
    		this.password = pwd;
     
    		connectToProvider();
    		getRessources();
    		setAddress();
    		setTerminal();
    		try {
    			Thread.sleep(1000);
    			waitFrame.addText("Lancement de l'interface...");
    			Thread.sleep(2000);
    			waitFrame.dispose();
    		} catch (InterruptedException e) {
    			e.printStackTrace();
    		}
    		new SoftDialerFrame(this).setVisible(true);
    	}
     
     
     
    	/************************************************************************/
     
    	/** Connect to provider */
    	synchronized public void connectToProvider(){
    		try{
    			waitFrame.addText("Initialisation de la connexion avec le serveur...");
    			myJtapiPeer = (CiscoJtapiPeer)JtapiPeerFactory.getJtapiPeer(null);
    			myProvider  = (CiscoProvider)myJtapiPeer.getProvider(ccmAddress+";login="+login+";passwd="+password);
    			myProvider.addObserver(new MyProviderObserver());
    			Thread.sleep(1000);
    			waitFrame.addText("Connexion avec le serveur etablie...");
    			Thread.sleep(1000);
    		}
    		catch (Exception e)
    		{
    			waitFrame.addText("Connexion impossible avec le serveur...");
    			System.exit(0);
    		}
    	}
     
    	/** Get addresses and terminals from User */
    	public void getRessources() {
    		try {
    			waitFrame.addText("Récupération des ressources utilisateur...");
    			Thread.sleep(1000);
    			//myAddresses = myProvider.getAddresses();
    			myTerminals = myProvider.getTerminals();
     
    		} 
    		catch (Exception e) {
    			waitFrame.addText("Impossible de récupérer les ressources utilisateur...");
    			System.exit(0);
    		}
    	}
     
    	/** Set Address from Dialing Number */
    	public void setAddress(){
    		try {
    			myAddress = (CiscoAddress)myProvider.getAddress(dialingNumber);
    			myAddress.addCallObserver(new MyCallObserver());
    			waitFrame.addText("Adresse d'origine configurée sur : "+myAddress.toString());
    		} 
    		catch (Exception e) {
    			waitFrame.addText("Impossible d'attribuer l'adresse...");
    			System.exit(0);
    		} 
    	}
     
    	/** Set Terminal */
    	public void setTerminal(){
    		for( int i=0 ; i<myTerminals.length ; i++ )
    			if( myAddress.getTerminals()[0] == myTerminals[i] )
    				myTerminal = (CiscoTerminal)myTerminals[i];
    		try {
    			myTerminal.addCallObserver(new MyCallObserver());
    		} catch (Exception e) {
    			e.printStackTrace();
    		}	
     
    		waitFrame.addText("Terminal d'origine configuré sur : "+myTerminal.getName());
    	}
     
    	/** Dial Number */
    	public void dialNumber(String dest){
    		myCiscoCall = null;
    		try {
    			myCiscoCall = (CiscoCall) ( ((Provider)myProvider).createCall());
    			myCiscoCall.setConferenceEnable(true);
    			myCiscoCall.connect(myTerminal, myAddress, dest);
     
    		} 
    		catch (Exception e) {
    			System.out.println("Error in creating call"+e.toString());
    			JOptionPane.showMessageDialog(null,"Impossible d'établir l'appel", "Erreur",JOptionPane.ERROR_MESSAGE);
    		}
    	}
     
    	/** Transfer Call */
    	public void TransfertCall( String dest ){
    		try {
    			myCiscoCall.transfer(dest);
    		} catch (Exception e) {
    			JOptionPane.showMessageDialog(null,"Impossible de transferer l'appel", "Erreur",JOptionPane.ERROR_MESSAGE);
    		} 
    	}
     
    	/** Conference Call */
    	public void ConferenceCall( String dest ){
    		try {
    			CiscoCall myCiscoCall1 = (CiscoCall) ( ((Provider)myProvider).createCall());
    			myCiscoCall1.connect(myTerminal, myAddress, dest);
    			myCiscoCall.conference(myCiscoCall1);
    		} 
    		catch (Exception e) {
    			JOptionPane.showMessageDialog(null,"Impossible d'établir la conférence", "Erreur",JOptionPane.ERROR_MESSAGE);
    		} 
    	}
     
    	/** Answer call */
    	public void Answer(){
    		try {
     
    			TerminalConnection[] ctc = myTerminal.getTerminalConnections();
    			ctc[0].answer();
     
    		} catch (Exception e) {
    			e.printStackTrace();
    		} 
    	}
     
    	/** Hang off */
    	public void HandOff(){
     
    		try {
    			myAddress.getConnections()[0].disconnect();
    		} catch (Exception e1) {
    			e1.printStackTrace();
    		} 
    	}
     
    	public void setCcmAddress(String ccmAddress) {
    		this.ccmAddress = ccmAddress;
    	}
     
    	public void setDialingNumber(String dialingNumber) {
    		this.dialingNumber = dialingNumber;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public void setPassword(String password) {
    		this.password = password;
    	}
     
    }

  4. #4
    Expert éminent sénior
    Avatar de sinok
    Profil pro
    Inscrit en
    Août 2004
    Messages
    8 765
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Paris (Île de France)

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Beh tu vas pouvoir déthreader toutes tes frame: Swing n'est pas un Toolkit Thread safe (pas sur qu'il en existe des masses de toolkits ThreadSafe)

    Ces opérations doivent s'effectuer dans un thread bien spécifique: l'EDT et pas un autre.

    Pour mieux comprendre:

    http://gfx.developpez.com/tutoriel/j...ing-threading/

    Et de quoi faciliter l'utilisation de Swing et des threads:

    http://rom.developpez.com/java-swingworker/
    Hey, this is mine. That's mine. All this is mine. I'm claiming all this as mine. Except that bit. I don't want that bit. But all the rest of this is mine. Hey, this has been a really good day. I've eaten five times, I've slept six times, and I've made a lot of things mine. Tomorrow, I'm gonna see if I can't have sex with something.

  5. #5
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut
    Au début, il n'y avait pas de thread dans mes frames. J'ai mis les threads afin d'espérer résoudre ce pbm. Je sais que si j'enleve les threads, j'aurai le même probleme...

  6. #6
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut
    up !

  7. #7
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2007
    Messages
    572
    Détails du profil
    Informations personnelles :
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations forums :
    Inscription : Février 2007
    Messages : 572
    Points : 675
    Points
    675
    Par défaut
    Enleve les threads, puisqu'ils ne servent à rien, et reposte le code ...

  8. #8
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut
    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
    /*
     * Info.java
     *
     * Created on 30 juillet 2007, 13:30
     */
     
    package pkg_IHM;
     
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.io.InputStream;
     
    import javax.imageio.ImageIO;
    import javax.swing.ImageIcon;
     
    /**
     *
     * @author  elfiestador
     */
    public class WaitFrame extends javax.swing.JFrame{
     
        /**
             * 
             */
    	private static final long serialVersionUID = 3868697665963167148L;
     
    	/** Creates new form Info */
        public WaitFrame() {
            initComponents();
        }
     
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents() {
            jPanel1 = new GradientPanel( Color.BLACK, Color.GRAY );
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
     
            try {
            	InputStream is1 = getClass().getResourceAsStream("/artwork/phone.png");
            	//BufferedImage bi = ImageIO.read( new File("artwork/phone.png") );
    			BufferedImage bi = ImageIO.read(is1);
            	ImageIcon ii = new ImageIcon(bi);
    			jLabel2.setIcon(ii);
    		} catch (IOException e) {
    			e.printStackTrace();
    		}
     
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setTitle("Connexion");
            jLabel1.setFont(new java.awt.Font("Dialog", 1, 24));
            jLabel1.setForeground(new java.awt.Color(204, 204, 204));
            jLabel1.setText("Connexion avec le serveur");
     
            jLabel3.setForeground(new java.awt.Color(204, 204, 204));
            jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
     
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(116, 116, 116)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE))))
                    .addContainerGap())
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(35, 35, 35)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap())
            );
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
            pack();
     
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            this.setLocation((screen.width - this.getSize().width)/2,(screen.height - this.getSize().height)/2); 
     
     
            setVisible(true);
            repaint();
     
        }// </editor-fold>
     
     
        // Variables declaration - do not modify
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        public javax.swing.JPanel jPanel1;
        // End of variables declaration
        public void addText( String txt ) {
    		jLabel3.setText(txt);
    	}
     
    }
    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
    /*
     * AuthentificationFrame.java
     *
     * Created on 1 août 2007, 15:52
     */
     
    package pkg_IHM;
     
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Toolkit;
     
    import pkg_CISCO.CiscoLib;
     
    /**
     *
     * @author  elfiestador
     */
    public class AuthentificateFrame extends javax.swing.JFrame{
     
        /**
             * 
             */
    	private static final long serialVersionUID = -8608817706415014581L;
    	private String ccm, dn, login;
     
     
    	public AuthentificateFrame(String ccm, String dn, String login) {
        	this.ccm = ccm;
        	this.dn = dn;
        	this.login = login;
    		initComponents();
        }
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
        private void initComponents(/*String ccm, String dn, String login*/) {
            jPanel1 = new GradientPanel( Color.BLACK, Color.GRAY );
            jTextFieldUser = new javax.swing.JTextField(this.login);
            jPasswordField = new javax.swing.JPasswordField();
            jTextFieldLine = new javax.swing.JTextField(this.dn);
            jTextFieldCCM = new javax.swing.JTextField(this.ccm);
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            jLabel4 = new javax.swing.JLabel();
            jLabel5 = new javax.swing.JLabel();
            jButtonAuth = new PngButton("artwork/keyb.png","artwork/keyh.png");
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
     
            jLabel2.setText("Utilisateur");
            jLabel2.setForeground(new java.awt.Color(204, 204, 204));
            jLabel3.setText("Password");
            jLabel3.setForeground(new java.awt.Color(204, 204, 204));
            jLabel4.setText("Ligne");
            jLabel4.setForeground(new java.awt.Color(204, 204, 204));
            jLabel5.setText("Serveur");
            jLabel5.setForeground(new java.awt.Color(204, 204, 204));
     
            jButtonAuth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButtonAuthActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(43, 43, 43)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jLabel2)
                                .addComponent(jLabel3)
                                .addComponent(jLabel4)
                                .addComponent(jLabel5))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jPasswordField)
                                .addComponent(jTextFieldUser, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
                                .addComponent(jTextFieldLine)
                                .addComponent(jTextFieldCCM)))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(82, 82, 82)
                            .addComponent(jButtonAuth, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(88, Short.MAX_VALUE))
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jButtonAuth, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(23, 23, 23)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldLine, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextFieldCCM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel5))
                    .addContainerGap(24, Short.MAX_VALUE))
            );
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            pack();
            Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
            this.setLocation((screen.width - this.getSize().width)/2,(screen.height - this.getSize().height)/2);
            this.setVisible(true);
     
        }// </editor-fold>
     
        private void jButtonAuthActionPerformed(java.awt.event.ActionEvent evt) {
        	this.dispose();
        	new CiscoLib(getJTextFieldUser(), getJPasswordField(), getJTextFieldLine(), getJTextFieldCCM());
    	}
     
     
     
     
        // Variables declaration - do not modify
        private javax.swing.JButton jButtonAuth;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPasswordField jPasswordField;
        private javax.swing.JTextField jTextFieldCCM;
        private javax.swing.JTextField jTextFieldLine;
        private javax.swing.JTextField jTextFieldUser;
        // End of variables declaration
     
        public String getJPasswordField() {
    		return new String(jPasswordField.getPassword());
    	}
     
    	public String getJTextFieldCCM() {
    		return jTextFieldCCM.getText();
    	}
     
    	public String getJTextFieldLine() {
    		return jTextFieldLine.getText();
    	}
     
    	public String getJTextFieldUser() {
    		return jTextFieldUser.getText();
    	}
     
    }

  9. #9
    Membre éclairé
    Profil pro
    Inscrit en
    Février 2007
    Messages
    572
    Détails du profil
    Informations personnelles :
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations forums :
    Inscription : Février 2007
    Messages : 572
    Points : 675
    Points
    675
    Par défaut
    Je pense que ce qui t'arrive, c'est que tu bloques le thread dans le constructeur de CiscoLib. Comme c'est le thread de dispatch des evenements (EDT), ca empeche le dessin de ta frame WaitFrame.
    Tu peux faire un test, si possible, en commentant le code apres new WaitFrame() dans le cas KO (ou tu appelles new WaitFrame() directement).
    Si c'est bien ca, le mieux c'est que tu te documentes sur l'EDT (EventDispatchThread), pour comprendre ce mécanisme. A coup sur, tu trouveras également differentes solutions pour ton problème.

  10. #10
    Membre régulier
    Homme Profil pro
    Ingénieur avant-vente
    Inscrit en
    Décembre 2006
    Messages
    59
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Ingénieur avant-vente
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Décembre 2006
    Messages : 59
    Points : 116
    Points
    116
    Par défaut
    Merci, j'ai commenté le code après, la frame s'est bien affichée.
    J'ai mis le code posant pbm dans un thread, ca marche nickel !

    Merci

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

Discussions similaires

  1. JFrame vide lorsqu'elle est appelée
    Par superpigeon dans le forum Agents de placement/Fenêtres
    Réponses: 8
    Dernier message: 27/03/2007, 18h23
  2. Problème de requêtes vides.
    Par syl2042 dans le forum Langage SQL
    Réponses: 1
    Dernier message: 14/03/2007, 00h04
  3. [XSLT] Problème de ligne vide dans le flux de sortie
    Par Guillaume.chatel dans le forum XSL/XSLT/XPATH
    Réponses: 4
    Dernier message: 07/02/2007, 09h57
  4. [Swing] JFrame vide !
    Par theniaky dans le forum Agents de placement/Fenêtres
    Réponses: 5
    Dernier message: 17/05/2006, 18h08

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