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 :

JFrame et setVisible()


Sujet :

Agents de placement/Fenêtres Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé Avatar de arkham55
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    179
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2010
    Messages : 179
    Par défaut JFrame et setVisible()
    Bonjour à tous et toutes,

    Voilà, j'ai un petit soucis lorsque je veux créer une fenêtre et l'afficher simplement...
    L'erreur proviendrait de l'instruction setVisible(true) après la création de l'objet Fenetre, j'ai essayé de mettre l'instruction dans le constructeur pour voir si changements il y avait mais là également l'erreur se produit.
    Le code du bouton d'appel et le code de la fenêtre :

    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
    	public JButton getJbAjouter(){
    		if(jbAjouter==null){
    			jbAjouter=new JButton("Ajouter");
    			jbAjouter.addActionListener(new ActionListener(){
     
    				public void actionPerformed(ActionEvent e) {
    					// TODO Raccord de méthode auto-généré
    					FenetreAjouterFormation f=new FenetreAjouterFormation(PaneListeFormation.this);
    					//f.setVisible(true);
    					PaneListeFormation.this.setEnabled(false);
    				}
     
    			});
    		}
    		return jbAjouter;
    	}
    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
    package projet;
     
    import javax.swing.*;
     
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;
    import java.util.Iterator;
     
    public class FenetreAjouterFormation extends JFrame{
     
    		private JLabel jlHead=new JLabel("Créer une formation :");
    		private JComboBox jcbCle1;
    		private JComboBox jcbCle2;
    		//private JSpinner jsCle3;
    		private JLabel jlCle=new JLabel("Clé unique :");
    		private JLabel jlCle1=new JLabel("Jour");
    		private JLabel jlCle2=new JLabel("Type");
    		//private JLabel jlCle3=new JLabel("Num");
     
    		private JLabel jlProf= new JLabel("Professeur :");
    		private JComboBox jcbProf;
     
    		private JLabel jlLoca=new JLabel("Localisation : ");
    		private JComboBox jcbLoca;
     
    		private JLabel jlListe = new JLabel("Choisissez les étudiants concernés :");
    		private JList jlEtudiant;
     
    		private JButton jbAjouter;
    		private JButton jbReini;
     
    		private PaneListeFormation fle;
     
    		public FenetreAjouterFormation(PaneListeFormation fle){
    			this.fle=fle;
    			this.setSize(550,380);
    			this.setResizable(false);
    			this.setTitle("Ajout d'une formation");
    			this.setLocation(400,300);
    			JPanel jp= new JPanel();
    			GroupLayout gp= new GroupLayout(jp);
     
    			jp.setLayout(gp);
     
    			gp.setHorizontalGroup(
    				gp.createSequentialGroup()
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlHead())
    								.addComponent(this.getJlCle())
    								.addComponent(this.getJlProf())
    								.addComponent(this.getJlLoca())
    								.addComponent(this.getJlListe())
    								.addComponent(this.getJbReini())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlCle1())
    								.addComponent(this.getJcbCle1())
    								.addComponent(this.getJcbProf())
    								.addComponent(this.getJcbLoca())
    								.addComponent(this.getJlEtudiant())
    					)
    					.addGap(0)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlCle2())
    								.addComponent(this.getJcbCle2())
    					)
    /*					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlCle3())
    								.addComponent(this.getJsCle3())
    								.addComponent(this.getJbAjouter())  
    					)  */
    			);
    			gp.setVerticalGroup(
    				gp.createSequentialGroup()
    					.addComponent(this.getJlHead())
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlCle1())
    								.addGap(0)
    								.addComponent(this.getJlCle2())
    //								.addComponent(this.getJlCle3())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlCle())
    								.addComponent(this.getJcbCle1())
    								.addComponent(this.getJcbCle2())
    //								.addComponent(this.getJsCle3())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlProf())
    								.addComponent(this.getJcbProf())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlLoca())
    								.addComponent(this.getJcbLoca())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJlListe())
    								.addComponent(this.getJlEtudiant())
    					)
    					.addGroup(
    							gp.createParallelGroup()
    								.addComponent(this.getJbReini())
    								.addComponent(this.getJbAjouter())
    					)
    			);
     
     
    //			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    			try {
    				UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
    			} catch (ClassNotFoundException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			} catch (InstantiationException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			} catch (IllegalAccessException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			} catch (UnsupportedLookAndFeelException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    			this.add(jp,BorderLayout.WEST);
    			this.setVisible(true);
    			this.setDefaultCloseOperation(FenetreListeProfesseur.DISPOSE_ON_CLOSE);
    		}
     
    		public JLabel getJlHead() {
    			return jlHead;
    		}
     
    		public JComboBox getJcbCle1() {
    			if(jcbCle1==null){
    				String[] jour = {"lun","mar","mer","jeu","ven","sam","dim"};
    				jcbCle1=new JComboBox(jour);
    				jcbCle1.setMaximumSize(new Dimension(60,30));
    				jcbCle1.setMinimumSize(new Dimension(60,30));
    				jcbCle1.setSelectedIndex(0);
    			}
    			return jcbCle1;
    		}
     
    		public JComboBox getJcbCle2() {
    			if(jcbCle2==null){
    				String[] type = {"parti","semi","group"};
    				jcbCle2=new JComboBox(type);
    				jcbCle2.setMaximumSize(new Dimension(70,30));
    				jcbCle2.setMinimumSize(new Dimension(70,30));
    				jcbCle2.setSelectedIndex(0);
    			}
    			return jcbCle2;
    		}
     
    		/*public JSpinner getJsCle3() {
    			if(jsCle3==null){
    				jsCle3=new JSpinner(new SpinnerNumberModel(1,1,100,1));
    				jsCle3.setMaximumSize(new Dimension(50,30));
    				jsCle3.setMinimumSize(new Dimension(50,30));
    				jsCle3.setValue(1);
    			}
    			return jsCle3;
    		}*/
     
    		public JLabel getJlCle1() {
    			return jlCle1;
    		}
     
    		public JLabel getJlCle2() {
    			return jlCle2;
    		}
     
    		/*public JLabel getJlCle3() {
    			return jlCle3;
    		}*/
     
    		public JLabel getJlProf() {
    			return jlProf;
    		}
     
    		public JComboBox getJcbProf() {
    			if(jcbProf==null){
    				jcbProf=new JComboBox(getNomsProfs());
    				jcbProf.setMaximumSize(new Dimension(160,30));
    				jcbProf.setMinimumSize(new Dimension(160,30));
    			}
    			return jcbProf;
    		}
    		public String[] getNomsProfs(){
    			String[] res = new String[this.fle.getPol().getListeProfesseur().size()];
    			for(int i=0;i<res.length;i++){
    				res[i]=this.fle.getPol().getListeProfesseur().get(i).getNom();
    			}
    			return res;
    		}
     
    		public JLabel getJlCle() {
    			return jlCle;
    		}
     
    		public JButton getJbAjouter() {
    			if(jbAjouter==null){
    				jbAjouter= new JButton("Ajouter");
    				jbAjouter.setPreferredSize(new Dimension(70,30));
    				jbAjouter.addActionListener(new ActionListener(){
     
    					public void actionPerformed(ActionEvent arg0) {
    						// TODO Raccord de méthode auto-généré
    						Formation nouvelle=null;
    						if(etudiantIsSelected()){
    							String clef = getClef();
    							//String prof = FenetreAjouterFormation.this.jcbProf.getSelectedItem().toString();
    							String type = getTypeCours();
    							String loca = getLocalisation();
    							//System.out.println(clef+" "+prof+" "+type);
     
    							Professeur p = FenetreAjouterFormation.this.fle.getPol().getProfesseur(FenetreAjouterFormation.this.jcbProf.getSelectedIndex());
    							ArrayList<Etudiant> e = getListEtudiant();
     
    							nouvelle = new Formation(clef,type,loca);
    							nouvelle.affecterProfesseur(p);
    							nouvelle.affecterEtudiants(e);
    							FenetreAjouterFormation.this.fle.getPol().ajouterFormation(nouvelle);
     
    							FenetreAjouterFormation.this.setVisible(false);
    							FenetreAjouterFormation.this.fle.setEnabled(true);
    							FenetreAjouterFormation.this.fle.setVisible(true);
    							FenetreAjouterFormation.this.fle.rafraichir();
     
    						}
     
    					}
     
    				});
    			}
    			return jbAjouter;
    		}
    		public boolean etudiantIsSelected(){
    			boolean res=false;
    			if(this.jlEtudiant.getSelectedIndex()!=-1){
    				res=true;
    			}else{
    				res=false;
    			}
    			return res;
    		}
    		public ArrayList<Etudiant> getListEtudiant(){
    			ArrayList<Etudiant> res= new ArrayList<Etudiant>();
     
    			int[] selection = this.jlEtudiant.getSelectedIndices();
     
    			for(int i=0; i<selection.length;i++){
    				res.add(this.fle.getPol().getListeEtudiant().get(i));
    			}
     
    			return res;
    		}
    		public String getLocalisation(){
    			String res="";
    			res=(String) FenetreAjouterFormation.this.jcbLoca.getSelectedItem();
    			return res;
    		}
    		public String getTypeCours(){
    			String res ="";
     
    			if(FenetreAjouterFormation.this.jcbCle2.getSelectedIndex()==0){
    				res="Particulier";
    			}else{
    				if(FenetreAjouterFormation.this.jcbCle2.getSelectedIndex()==1){
    					res="Semi-privé";
    				}else{
    					res="Groupe";
    				}
    			}
    			return res;
    		}
    		public String getClef(){
    			String res="";
    			String clef1 = FenetreAjouterFormation.this.jcbCle1.getSelectedItem().toString();
    			String clef2 = FenetreAjouterFormation.this.jcbCle2.getSelectedItem().toString();
    			//Obligé de faire comme ceci, sinon 
    			String clef3 =test01.Nombre.convIntToString((FenetreAjouterFormation.this.fle.getPol().getNbFormation())+1);
     
    			res=clef1+clef2+clef3;
    			return res;
    		}
     
    		public JButton getJbReini() {
    			if(jbReini==null){
    				jbReini=new JButton("Réinitialiser");
    				jbReini.setPreferredSize(new Dimension(70,30));
    			}
    			return jbReini;
    		}
     
    		public JComboBox getJcbLoca() {
    			if(jcbLoca==null){
    				String[] choix = {"Polyac","En entreprise"};
    				jcbLoca=new JComboBox(choix);
    				jcbLoca.setMaximumSize(new Dimension(120,30));
    				jcbLoca.setMinimumSize(new Dimension(120,30));
    			}
    			return jcbLoca;
    		}
     
    		public JLabel getJlLoca() {
    			return jlLoca;
    		}
     
    		public JList getJlEtudiant() {
    			if(jlEtudiant==null){
    				jlEtudiant=new JList();
    				jlEtudiant.setMinimumSize(new Dimension(100,100));
    				jlEtudiant.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    				jlEtudiant.setListData(this.fle.getPol().listeIdentifiantsEtudiants());
    				jlEtudiant.setToolTipText("Maintenir CRTL pour effectuer une selection de plusieurs étudiants");
    			}
    			return jlEtudiant;
    		}
     
    		public JLabel getJlListe() {
    			return jlListe;
    		}
     
    		public PaneListeFormation getFle() {
    			return fle;
    		}
    }
    Merci d'avance d'y avoir jeter un petit coup d'oeil.

  2. #2
    Membre Expert

    Homme Profil pro
    Responsable des études
    Inscrit en
    Mars 2009
    Messages
    553
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Responsable des études
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2009
    Messages : 553
    Par défaut
    Salut,
    Tu peux indiquer le message d'erreur, STP?

  3. #3
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Étant donné que les avions ne décollent et n'atterrissent plus en Europe depuis hier, les livraisons à destination des membres du forum se sont vues retarder jusque nouvel ordre. Par conséquent, la distribution de boules de crystal qui était prévue pour ce matin est reportée à une date indéterminée. Comme il est interdit par les lois sur la sécurité de la chaine alimentaire de procéder à des abattage de poulet divinatoire, il nous est donc impossible de répondre à cette question sans connaître les détails de l'erreur que vous avez sus mentionnée. Nous en somme bien contrits.

  4. #4
    Membre confirmé Avatar de arkham55
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    179
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2010
    Messages : 179
    Par défaut
    Tout mais pas les poulets divinatoires!! T__T

    le voici, avec mes excuses :

    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
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.synth.SynthBorder@4b12d9,flags=288,maximumSize=,minimumSize=,preferredSize=java.awt.Dimension[width=70,height=30],defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Ajouter,defaultCapable=true] is not attached to a horizontal group
    	at javax.swing.GroupLayout.checkComponents(Unknown Source)
    	at javax.swing.GroupLayout.prepare(Unknown Source)
    	at javax.swing.GroupLayout.preferredLayoutSize(Unknown Source)
    	at java.awt.Container.preferredSize(Unknown Source)
    	at java.awt.Container.getPreferredSize(Unknown Source)
    	at javax.swing.JComponent.getPreferredSize(Unknown Source)
    	at java.awt.BorderLayout.layoutContainer(Unknown Source)
    	at java.awt.Container.layout(Unknown Source)
    	at java.awt.Container.doLayout(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validate(Unknown Source)
    	at java.awt.Window.show(Unknown Source)
    	at java.awt.Component.show(Unknown Source)
    	at java.awt.Component.setVisible(Unknown Source)
    	at java.awt.Window.setVisible(Unknown Source)
    	at projet.FenetreAjouterFormation.<init>(FenetreAjouterFormation.java:136)
    	at projet.PaneListeFormation$2.actionPerformed(PaneListeFormation.java:134)
    	at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    	at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    	at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    	at java.awt.Component.processMouseEvent(Unknown Source)
    	at javax.swing.JComponent.processMouseEvent(Unknown Source)
    	at java.awt.Component.processEvent(Unknown Source)
    	at java.awt.Container.processEvent(Unknown Source)
    	at java.awt.Component.dispatchEventImpl(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    	at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    	at java.awt.Container.dispatchEventImpl(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.synth.SynthBorder@4b12d9,flags=288,maximumSize=,minimumSize=,preferredSize=java.awt.Dimension[width=70,height=30],defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Ajouter,defaultCapable=true] is not attached to a horizontal group
    	at javax.swing.GroupLayout.checkComponents(Unknown Source)
    	at javax.swing.GroupLayout.prepare(Unknown Source)
    	at javax.swing.GroupLayout.preferredLayoutSize(Unknown Source)
    	at java.awt.Container.preferredSize(Unknown Source)
    	at java.awt.Container.getPreferredSize(Unknown Source)
    	at javax.swing.JComponent.getPreferredSize(Unknown Source)
    	at java.awt.BorderLayout.layoutContainer(Unknown Source)
    	at java.awt.Container.layout(Unknown Source)
    	at java.awt.Container.doLayout(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validate(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: javax.swing.JButton[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.synth.SynthBorder@4b12d9,flags=288,maximumSize=,minimumSize=,preferredSize=java.awt.Dimension[width=70,height=30],defaultIcon=,disabledIcon=,disabledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=0,left=0,bottom=0,right=0],paintBorder=true,paintFocus=true,pressedIcon=,rolloverEnabled=true,rolloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=Ajouter,defaultCapable=true] is not attached to a horizontal group
    	at javax.swing.GroupLayout.checkComponents(Unknown Source)
    	at javax.swing.GroupLayout.prepare(Unknown Source)
    	at javax.swing.GroupLayout.preferredLayoutSize(Unknown Source)
    	at java.awt.Container.preferredSize(Unknown Source)
    	at java.awt.Container.getPreferredSize(Unknown Source)
    	at javax.swing.JComponent.getPreferredSize(Unknown Source)
    	at java.awt.BorderLayout.layoutContainer(Unknown Source)
    	at java.awt.Container.layout(Unknown Source)
    	at java.awt.Container.doLayout(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validateTree(Unknown Source)
    	at java.awt.Container.validate(Unknown Source)
    	at java.awt.Window.dispatchEventImpl(Unknown Source)
    	at java.awt.Component.dispatchEvent(Unknown Source)
    	at java.awt.EventQueue.dispatchEvent(Unknown Source)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    	at java.awt.EventDispatchThread.run(Unknown Source)

  5. #5
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    apparement ton JButton est bien dans le groupe vertical mais pas dans le groupe horizontal -> impossible pour le layout de positionner. Je connais vraiment pas ce layout, mais dans la javadoc ils ont l'air de systématiquement faire apparraitre les composant dans les deux groupe (horizontal et vertical). Probablement du aux lignes commentées dans ton code .

  6. #6
    Membre confirmé Avatar de arkham55
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    179
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mars 2010
    Messages : 179
    Par défaut
    Roh mais c'est tout à fait ça on dirait! C'est ma faute, suite à une mise à jour dans mon code j'ai zappé ce passage T_T Honte à moi...
    Merci pour ce coup d'oeil de Lynx ^^

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

Discussions similaires

  1. Fenêtre qui appelle une fenêtre => JFrame.setVisible() fonctionne mal
    Par kirire dans le forum Agents de placement/Fenêtres
    Réponses: 8
    Dernier message: 03/01/2015, 23h57
  2. Rendre JFrame "invisible" sans utiliser setVisible ou setSize
    Par kattig dans le forum Agents de placement/Fenêtres
    Réponses: 10
    Dernier message: 23/06/2009, 18h26
  3. JFrame, setVisible et setExtendedState
    Par BestFF dans le forum Agents de placement/Fenêtres
    Réponses: 0
    Dernier message: 05/09/2008, 19h14
  4. Comment mettre une image en fond de JFrame
    Par marc26 dans le forum Débuter
    Réponses: 3
    Dernier message: 19/01/2004, 17h57
  5. Faire une JFrame avec LookAndFeel
    Par aburner dans le forum Agents de placement/Fenêtres
    Réponses: 5
    Dernier message: 03/12/2003, 08h54

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