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

Composants Java Discussion :

Exception "contentPane cannot be set to null"


Sujet :

Composants Java

  1. #1
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut Exception "contentPane cannot be set to null"
    bonjour,

    j'ai un formulaire de connection qui permet, en fonction de ses droits
    (Mot de passe) d'aller sur un 'domaine' choisi.
    Jusqu'à présent il marchait fort bien mais depuis 2 jours je reçois systématiquement ce message d'exception.

    Certaines parties du code sont confidentielles (mots de passe) donc je fait
    la description rapide du formulaire,

    - Frame (avec les imports nécessaires)

    - JPanel ("contentPane") --> private JPanel contentPaneF3 = new JPanel();

    - public Constructeur : super(), build()

    - private void build : description du Frame + appel à la méthode qui construit le JPanel
    --> private JPanel buildContentPane().
    avec les zones nécessaires +
    1 bouton pour chaque domaine avec listener.

    - public void actionPerformed(ActionEvent e)
    Object source = e.getSource();

    en fonction du bouton cliqué et si les droits sont bons aller sur un autre frame, procédures multiples gérées de manière conditionnelle.

    pseudo-code :

    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
    if source = bouton Budget
     
          try {
     
             if droit = admin 
            {
             aller formulaire admin
             }
              if droit = gestionnaire 
            {
             aller formulaire gestionnaire
             }
           }
           catch (exception){} C'EST LA OU JE RECUPERE L'EXCEPTION
           finally {}
    Je n'ai pas su trouver d'autres infos et ma recherche internet (une après-midi) est restée vaine
    Une idée du pourquoi ?

  2. #2
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    Je précise mon environnement de travail :

    - Windows XP sp3
    - Eclipse Juno + GWT Designer

  3. #3
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    Ce qui est curieux c'est que dans le message d'exception il me dit
    "contentPane cannot be set to Null"
    au lieu de
    "contentPaneF3 cannot be set to Null"
    qui est le nom du JPanel...

  4. #4
    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 : 45
    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
    si tu commencais par nous donner l'exception et le code, au lieu d'une vague idée du problème?

    Ensuite, si c'est JFrame qui lance cette erreur, c'est probablement que tu a fais en gros un

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jframe.setContentPane(null)

  5. #5
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    Je ne crois pas que ça soit vague....

    this.setContentPane(buildContentPane()); --> appelle la méthode qui construit le contentPane

    L'exception est "contentPane cannot be set to null"

    Je viens de vérifier dans l'ancien formulaire, qui lui marche sans problème,
    et la construction du code est identique... Tous mes formulaires sont construits de la même manière et tous les autres formulaires fonctionnent.
    J'utilise simplement un GridBagLayout au lieu d'un GridLayout.

    Ce formulaire s'affiche aussi mais l'exception est levée lors du choix d'un domaine, lors du click d'un bouton donc.

    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
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
     
    package ...;
     
    //=== AWT
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Dimension;
    import java.awt.Insets;
    import java.awt.Font;
    import java.awt.Color;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
     
    //=== SWING
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import javax.swing.SwingConstants;
    import javax.swing.JPasswordField;
    import javax.swing.JButton;
    import javax.swing.border.LineBorder;
    import org.eclipse.wb.swing.FocusTraversalOnArray;
    import java.awt.Component;
     
     
    public class F3_ChoixDomaine extends JFrame implements ActionListener{
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 7153360834979267461L;
     
    	private JPanel contentPaneF3 = new JPanel();
    	private JTextField F3_txtPassword = new JTextField();
    	private JPasswordField F3_passwordField  = new JPasswordField();
    	private JTextField F3_txtValidezDomaine = new JTextField();
    	private JButton btAbsences = new JButton("ABSENCES");
    	private JButton btBudget = new JButton("BUDGET");
    	private JButton btDomaine = new JButton("DOMAINE");
    	private JButton btManifestations = new JButton("MANIFESTATIONS");
    	private JButton btPressing = new JButton("PRESSING");
    	private JButton btRecrutement = new JButton("RECRUTEMENT");
    	private JButton btOuvertures = new JButton("OUVERTURES");
    	private JButton btQuitter = new JButton("QUITTER");
     
     
    	//COULEURS
    	//private Color c_rouge  = new Color(255,0,0);
    	//private Color c_vert  = new Color(0,255,0);
    	//private Color c_bleu  = new Color(0,0,255);
     
     
    	/**
             * Crée le formulaire.
             */
    	public F3_ChoixDomaine() {
     
    		super(); 
    		build();//Cconstruction du 'Frame'
     
    	}
     
    		private void build()
    		{	 			
     
    			//============================ TITRE DE LA FENETRE ====================
    			this.setTitle("F3  : Connection domaines");
     
    			//====== TAILLE DE LA FENETRE ==========
    			//setMinimumSize(new Dimension(200, 400));
    			this.setSize(320, 400);
    			this.setResizable(false); //On interdit le redimensionnement de la fenetre
    			setBackground(new Color(255, 182, 193));
     
    			//========================== FERMETURE DU FRAME =======================
    			this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    			//this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
    			//========== POSITION DU FRAME AU CENTRE DE L'ECRAN  =================
    			this.setLocationRelativeTo(null);
     
    			//=============== APPELLE LA METHODE POUR CREER LE PANEL ==============  
     
    			this.setContentPane(buildContentPane());
    			contentPaneF3.setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]{F3_txtPassword, F3_passwordField, F3_txtValidezDomaine, btAbsences, btBudget, btDomaine, btManifestations, btPressing, btRecrutement, btOuvertures, btQuitter}));
     
    			//===================== AFFICHE LE FRAME ==============================  
    			this.setVisible(true);
     
    		}
     
    		//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    		//======================== METHODE POUR CONSTRUIRE LE PANEL ===============
    		//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
     
    		private JPanel buildContentPane(){
     
     
    		//Marge verticale entre les éléments
    		int vBoutonsInset = 10;
     
    		//========================== AJOUT DU PANEL ===============================
    		contentPaneF3.setSize(new Dimension(200, 300));
    		contentPaneF3.setBackground(new Color(255, 165, 0));
    		contentPaneF3.setForeground(new Color(255, 255, 255));
    		contentPaneF3.setBorder(new LineBorder(new Color(0, 0, 0)));
     
    		//Layout de 'contentPane'
    		GridBagLayout gbl_contentPane = new GridBagLayout();
    		gbl_contentPane.columnWidths = new int[]{250};
    		contentPaneF3.setLayout(gbl_contentPane);
     
    		//Zone de texte
    		//F3_txtPassword = new JTextField();
    		F3_txtPassword.setFont(new Font("Serif", Font.BOLD, 11));
    		F3_txtPassword.setBackground(new Color(255, 215, 0));
    		F3_txtPassword.setEditable(false);
    		//F3_txtPassword.setSize(new Dimension(320,20));
    		//F3_txtPassword.setPreferredSize(new Dimension(305,20));
    		F3_txtPassword.setHorizontalAlignment(SwingConstants.CENTER);
    		F3_txtPassword.setText("Entrez votre mot de passe en minuscules,");
    		GridBagConstraints gbc_F3_txtPassword = new GridBagConstraints();
    		gbc_F3_txtPassword.fill = GridBagConstraints.BOTH;
    		gbc_F3_txtPassword.insets = new Insets(0, 0, 5, 0);
    		gbc_F3_txtPassword.gridx = 0;
    		gbc_F3_txtPassword.gridy = 0;
    		contentPaneF3.add(F3_txtPassword, gbc_F3_txtPassword);
     
    		//Zone du mot de passe
    		//F3_passwordField = new JPasswordField();
    		F3_passwordField.setFont(new Font("Serif", Font.BOLD, 12));
    		F3_passwordField.setHorizontalAlignment(SwingConstants.CENTER);
    		F3_passwordField.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_F3_passwordField = new GridBagConstraints();
    		gbc_F3_passwordField.insets = new Insets(0, 0, 5, 0);
    		gbc_F3_passwordField.gridx = 0;
    		gbc_F3_passwordField.gridy = 1;
    		contentPaneF3.add(F3_passwordField, gbc_F3_passwordField);
     
    		//Zone de texte
    		//F3_txtValidezDomaine = new JTextField();
    		F3_txtValidezDomaine.setFont(new Font("Serif", Font.BOLD, 11));
    		F3_txtValidezDomaine.setText("puis validez en cliquant sur le domaine choisi");
    		//F3_txtValidezDomaine.setPreferredSize(new Dimension(305,20));
    		F3_txtValidezDomaine.setHorizontalAlignment(SwingConstants.CENTER);
    		F3_txtValidezDomaine.setEditable(false);
    		F3_txtValidezDomaine.setColumns(10);
    		F3_txtValidezDomaine.setBackground(new Color(255, 215, 0));
    		GridBagConstraints gbc_F3_txtValidezDomaine = new GridBagConstraints();
    		gbc_F3_txtValidezDomaine.fill = GridBagConstraints.BOTH;
    		gbc_F3_txtValidezDomaine.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_F3_txtValidezDomaine.gridx = 0;
    		gbc_F3_txtValidezDomaine.gridy = 2;
    		contentPaneF3.add(F3_txtValidezDomaine, gbc_F3_txtValidezDomaine);
     
     
    		//======================= BOUTONS DE VALIDATION =========================
     
    		//ABSENCES
    		//btAbsences = new JButton("ABSENCES");
    		btAbsences.setFont(new Font("Serif", Font.BOLD, 12));
    		btAbsences.setBackground(new Color(240, 230, 140));
    		btAbsences.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btAbsences = new GridBagConstraints();
    		gbc_btAbsences.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_btAbsences.gridx = 0;
    		gbc_btAbsences.gridy = 3;
    		btAbsences.addActionListener(this);
    		contentPaneF3.add(btAbsences, gbc_btAbsences);
     
    		//BUDGET
    		//btBudget = new JButton("BUDGET");
    		btBudget.setFont(new Font("Serif", Font.BOLD, 12));
    		btBudget.setBackground(new Color(255, 255, 0));
    		btBudget.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btBudget = new GridBagConstraints();
    		gbc_btBudget.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_btBudget.gridx = 0;
    		gbc_btBudget.gridy = 4;
    		btBudget.addActionListener(this);
    		contentPaneF3.add(btBudget, gbc_btBudget);
     
    		//DOMAINE
    		//btDomaine = new JButton("DOMAINE");
    		btDomaine.setFont(new Font("Serif", Font.BOLD, 12));
    		btDomaine.setBackground(new Color(127, 255, 0));
    		btDomaine.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btDomaine = new GridBagConstraints();
    		gbc_btDomaine.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_btDomaine.gridx = 0;
    		gbc_btDomaine.gridy = 5;
    		btDomaine.addActionListener(this);
    		contentPaneF3.add(btDomaine, gbc_btDomaine);
     
    		//MANIFESTATIONS
    		//btManifestations = new JButton("MANIFESTATIONS");
    		btManifestations.setFont(new Font("Serif", Font.BOLD, 12));
    		btManifestations.setBackground(new Color(233, 150, 122));
    		btManifestations.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btManifestations = new GridBagConstraints();
    		gbc_btManifestations.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_btManifestations.gridx = 0;
    		gbc_btManifestations.gridy = 6;
    		btManifestations.addActionListener(this);
    		contentPaneF3.add(btManifestations, gbc_btManifestations);
     
    		//PRESSING
    		//btPressing = new JButton("PRESSING");
    		btPressing.setFont(new Font("Serif", Font.BOLD, 12));
    		btPressing.setBackground(new Color(176, 196, 222));
    		btPressing.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btPressing = new GridBagConstraints();
    		gbc_btPressing.insets = new Insets(0, 0,vBoutonsInset, 0);
    		gbc_btPressing.gridx = 0;
    		gbc_btPressing.gridy = 7;
    		btPressing.addActionListener(this);
    		contentPaneF3.add(btPressing, gbc_btPressing);
     
    		//RECRUTEMENT
    		//btRecrutement = new JButton("RECRUTEMENT");
    		btRecrutement.setFont(new Font("Serif", Font.BOLD, 12));
    		btRecrutement.setBackground(new Color(210, 105, 30));
    		btRecrutement.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btRecrutement = new GridBagConstraints();
    		gbc_btRecrutement.insets = new Insets(0, 0, vBoutonsInset, 0);
    		gbc_btRecrutement.gridx = 0;
    		gbc_btRecrutement.gridy = 8;
    		btRecrutement.addActionListener(this);
    		contentPaneF3.add(btRecrutement, gbc_btRecrutement);
     
    		//OUVERTURES
    		//btOuvertures = new JButton("OUVERTURES");
    		btOuvertures.setFont(new Font("Serif", Font.BOLD, 12));
    		btOuvertures.setBackground(new Color(123, 104, 238));
    		btOuvertures.setPreferredSize(new Dimension(180,20));
    		GridBagConstraints gbc_btOuvertures = new GridBagConstraints();
    		gbc_btOuvertures.insets = new Insets(0, 0, 30, 0); //L'inset est + grand pour éloigner le bouton 'Quitter'
    		gbc_btOuvertures.gridx = 0;
    		gbc_btOuvertures.gridy = 9;
    		btOuvertures.addActionListener(this);
    		contentPaneF3.add(btOuvertures, gbc_btOuvertures);
     
    		//QUITTER
    		//btQuitter = new JButton("QUITTER");
    		btQuitter.setForeground(new Color(0, 0, 205));
    		btQuitter.setFont(new Font("Serif", Font.BOLD, 12));
    		btQuitter.setPreferredSize(new Dimension(180, 20));
    		btQuitter.setBackground(new Color(211, 211, 211));
    		GridBagConstraints gbc_btQuitter = new GridBagConstraints();
    		gbc_btQuitter.insets = new Insets(0, 0, 5, 0);
    		gbc_btQuitter.gridx = 0;
    		gbc_btQuitter.gridy = 10;
    		btQuitter.addActionListener(this);
    		contentPaneF3.add(btQuitter, gbc_btQuitter);
     
    		return contentPaneF3; //Les 2 formes marchent.
    		//return (contentPaneF3);
    	}
     
    	 /**
                * actionPerformed(ActionEvent e) / Ecoute les boutons
                */
    	    //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
    		//======================== METHODE POUR 'ECOUTER' LES BOUTONS =======================
    		//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& 
    		public void actionPerformed(ActionEvent e) {
     
    			//Récupérer l'objet sur leque s'est produit l'event.
    			Object source = e.getSource();
     
    			//Vérification de 'event'. Avec toString() on obtient la description du bouton, pas son nom.
    			//ClassMessagesCreer maVerificationEvent = new ClassMessagesCreer("ActionPerformed", e.getSource().toString(), "");
     
    			//RECUPERER ET CONVERTIR LES VALEURS DES JPassword
    			char[] motdepasse = F3_passwordField.getPassword();
    			char[] dassArray = {};
     
    			//Convertir en String les valeurs des JPassword
    			String pwd=String.copyValueOf(motdepasse);
    			//Vérification du mot de passe
    			//ClassMessagesCreer maVerificationPass = new ClassMessagesCreer("Mot de passe", pwd, "");
     
    			//==================================
    			// Absences,Budget,Domaine,Manifs,Pressing,Recrute,TO
     
    			//TRI EXCEL SUR LE NOM PUIS SUR LE PRENOM
    			String userPwd1 = "_______";
    			char[] dassArray1 =  {'_','_','_','g','_','_','u'};	
    			//================================
    			String userPwd2 = "_______";
    			char[] dassArray2 =  {'_','_','_','u','_','u','u'};		
    			//==================================
    			String userPwd3 = "_______";
    			char[] dassArray3 =  {'_','_','_','u','_','_','u'};	
    			//==================================
    			String userPwd4 = "_______";
    			char[] dassArray4 =  {'_','_','_','u','_','g','_'};	
    			//==================================
    			String userPwd5 = "_______";
    			char[] dassArray5 =  {'u','u','u','u','u','g','u'};	
    			//==================================
    			String userPwd6 = "_______";
    			char[] dassArray6 =  {'_','_','u','_','_','_','u'};			
    			//==================================
    			String userPwd7 = "_______";
    			char[] dassArray7 =  {'_','_','_','_','_','u','u'};		
    			//==================================
    			String userPwd8 = "_______";
    			char[] dassArray8 =  {'g','g','_','_','_','_','u'};			
    			//==================================
    			String userPwd9 = "_______";
    			char[] dassArray9 =  {'a','a','a','a','a','a','a'};	
    			//==================================
    			String userPwd10 = "_______";
    			char[] dassArray10 =  {'u','_','_','u','u','_','u'};		
    			//==================================
    			String userPwd11 = "_______";
    			char[] dassArray11 =  {'_','_','_','_','_','g','u'};		
    			//==================================
    			String userPwd12 = "_______";
    			char[] dassArray12 =  {'u','_','_','u','_','_','u'};		
    			//==================================
    			String userPwd13 = "_______";
    			char[] dassArray13 =  {'_','_','g','u','_','_','u'};	
    			//==================================
    			String userPwd14 = "_______";
    			char[] dassArray14 =  {'_','_','g','_','_','_','u'};	
    			//==================================
    			String userPwd15 = "_______";
    			char[] dassArray15 =  {'_','_','_','u','u','_','u'};		
    			//==================================
    			String userPwd16 = "_______";
    			char[] dassArray16 =  {'_','_','_','g','_','_','u'};		
    			//==================================
    			String userPwd17 = "_______";
    			char[] dassArray17 =  {'_','_','g','_','_','_','u'};		
    			//==================================
    			String userPwd18 = "_______";
    			char[] dassArray18 =  {'_','g','_','_','_','g','u'};		
    			//==================================
    			String userPwd19 = "_______";
    			char[] dassArray19 =  {'_','_','g','u','_','_','u'};			
    			//==================================
    			String userPwd20 = "_______";
    			char[] dassArray20 =  {'u','u','u','u','u','u','u'};			
     
    			//==================================
     
    			if (pwd.equals(userPwd1)){ 
    				dassArray = dassArray1;
    			}
    			else if (pwd.equals(userPwd2)){ 
    				dassArray = dassArray2;		
    			}
    			else if (pwd.equals(userPwd3)){
    				dassArray = dassArray3;
    			}	
    			else if (pwd.equals(userPwd4)){ 
    				dassArray = dassArray4;	
    			}	
    			else if (pwd.equals(userPwd5)){ 
    				dassArray = dassArray5;	
    			}	
    			else if (pwd.equals(userPwd6)){ 
    				dassArray = dassArray6;
    			}	
    			else if (pwd.equals(userPwd7)){
    				dassArray = dassArray7;
    			}	
    			else if (pwd.equals(userPwd8)){
    				dassArray = dassArray8;
    			}	
    			else if (pwd.equals(userPwd9)){ 
    				dassArray = dassArray9;
    			}
    			else if (pwd.equals(userPwd10)){ 
    				dassArray = dassArray10;	
    			}	
    			else if (pwd.equals(userPwd11)){
    				dassArray = dassArray11;
    			}	
     
    			else if (pwd.equals(userPwd12)){ 
    				dassArray = dassArray12;
    			}	
    			else if (pwd.equals(userPwd13)){ 
    				dassArray = dassArray13;
    			}	
    			else if (pwd.equals(userPwd14)){ 
    				dassArray = dassArray14;
    			}
    			else if (pwd.equals(userPwd15)){ 
    				dassArray = dassArray15;
    			}
    			else if (pwd.equals(userPwd16)){ 
    				dassArray = dassArray16;
    			}
    			else if (pwd.equals(userPwd17)){ 
    				dassArray = dassArray17;
    			}
    			else if (pwd.equals(userPwd18)){ 
    				dassArray = dassArray18;
    			}
    			else if (pwd.equals(userPwd19)){ 
    				dassArray = dassArray19;
    			}
    			else if (pwd.equals(userPwd20)){ 
    				dassArray = dassArray20;
    			}
    			else{
    			ClassMessagesCreer monMessageSimple = new ClassMessagesCreer("Mot de passe inconnu");
    			return;
    			}
     
    			//============================================================================================
    			//======================================== 1 / ABSENCES ======================================
    			//============================================================================================
     
    			if(source == btAbsences){ //Absences
    			//if(e.getSource() == btAbsences){ //Absences
     
    				try { //Try
     
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
     
    					if (dassArray[0] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAbsAdmin = new F4_AdmGeneral();
    					}
     
    					else if (dassArray[0] == 'g'){
     
    						@SuppressWarnings("unused")
    						Manifs_AgentsVisu newAbsGest = new Manifs_AgentsVisu();	
    					}
     
    					else if (dassArray[0] == 'u'){
     
    						@SuppressWarnings("unused")
    						Manifs_AgentsVisu newAbsUser = new Manifs_AgentsVisu();	
    					}
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Absences Click",ex.getMessage());
    					//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
     
    				}
     
    				finally {}
     
    			}//Absences
     
    			//============================================================================================
    			//======================================= 2 / BUDGET =========================================
    			//============================================================================================
     
    			if(source == btBudget){ //Budget
     
    				try { //Try
     
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[1] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();	
    					}
    					else if (dassArray[1] == 'g'){
     
    						//FrameAbsGest newAbsGest = new FrameAbsGest();	
    					}
     
    					else if (dassArray[1] == 'u'){
     
    						//FrameAbsUser newAbsUser = new FrameAbsUser();
    					}
     
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					@SuppressWarnings("unused")
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Budget Click",ex.getMessage());
    					//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
    				}
     
    				finally {}
     
    			}//Budget
     
    			//============================================================================================
    			//====================================== 3 / DOMAINE =========================================
                //============================================================================================
     
    			if(source == btDomaine){ //Domaine
     
    				try { //Try
     
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[2] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();	
    					}
    					else if (dassArray[2] == 'g'){
     
     
    						//FrameAbsGest newAbsGest = new FrameAbsGest();	
    					}
     
    					else if (dassArray[2] == 'u'){
     
     
    						//FrameAbsUser newAbsUser = new FrameAbsUser();
    					}
     
     
     
    					else {
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Domaine Click",ex.getMessage());
    					//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
    				}
     
    				finally {}
     
    			}//Domaine
     
    			//============================================================================================
    			//====================================== 4 / MANIFS ==========================================
    			//============================================================================================
     
    			if(source == btManifestations){ //Manifs		
    				try { //Try
     
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[3] == 'a'){
     
    						//this.dispose();
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();
     
     
    					}
    					else if (dassArray[3] == 'g'){
     
    						@SuppressWarnings("unused")
    					    Manifs_AgentsVisu newAgentsVisu = new Manifs_AgentsVisu();	
     
    					}
     
    					else if (dassArray[3] == 'u'){
     
    						@SuppressWarnings("unused")
    					    Manifs_AgentsVisu newAgentsVisu = new Manifs_AgentsVisu();
    					}
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    			catch (Exception ex){
     
    				//Classe Exception Message
    				ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Manifestations Click",ex.getMessage());
    				//REMET LA ZT A ZERO
    				F3_passwordField.setText("");
    			}
     
     
    				finally {}
     
    			}//Manifs
     
    			//============================================================================================
    			//===================================== 5 / PRESSING =========================================
    			//============================================================================================
     
    			if(source == btPressing){ //Pressing
     
    				try { //Try
     
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[4] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();	
    					}
    					else if (dassArray[4] == 'g'){
     
    						//FrameAbsGest newAbsGest = new FrameAbsGest();	
    					}
     
    					else if (dassArray[4] == 'u'){
     
    						//FrameAbsUser newAbsUser = new FrameAbsUser();
    					}
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Pressing Click",ex.getMessage());		//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
    				}
     
    				finally {}
     
    			}//Pressing
     
    			//============================================================================================
    			//================================= 6/ TAUX D'OUVERTURE ======================================
    			//============================================================================================
     
    			if(source == btOuvertures){ //Taux d'ouverture
     
    				try { //Try
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[5] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();	
    					}
    					else if (dassArray[5] == 'g'){
     
    						//FrameAbsGest newAbsGest = new FrameAbsGest();	
    					}
     
    					else if (dassArray[5] == 'u'){
     
    						//FrameAbsUser newAbsUser = new FrameAbsUser();
    					}
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Ouvertures Click",ex.getMessage());		//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
    				}
     
    				finally {}
     
    			}//Taux d'ouverture
     
    			//============================================================================================
    			//==================================== 7 / RECRUTEMENT =======================================
    			//============================================================================================
     
    			if(source == btRecrutement){ //Recrutement
     
    				try { //Try
    					//ON APPELLE LE FRAME CORRESPONDANT AU DROIT DE L'UTILISATEUR
    					if (dassArray[6] == 'a'){
     
    						@SuppressWarnings("unused")
    						F4_AdmGeneral newAdmin = new F4_AdmGeneral();	
    					}
    					else if (dassArray[6] == 'g'){
     
    						//FrameAbsGest newAbsGest = new FrameAbsGest();	
    					}
     
    					else if (dassArray[6] == 'u'){
     
    						//FrameAbsUser newAbsUser = new FrameAbsUser();
    					}
     
    					else{
    						//APPEL A LA CLASSE 'MyTime'
    						MyTime importTime = new MyTime();
    						String nowTime = importTime.getuDate();
    						//MESSAGE DE CONNECTION ECHOUEE
    						javax.swing.JOptionPane.showMessageDialog(null,"CONNECTION REFUSEE A : " + nowTime);	
    					}//Else
     
    				}//Try
     
    				catch (Exception ex){
     
    					//Classe Exception Message
    					ClassMessagesCreer monException = new ClassMessagesCreer("Bouton Recrutement Click",ex.getMessage());
    					//REMET LA ZT A ZERO
    					F3_passwordField.setText("");
    				}
     
    				finally {}
     
    			}//Recrutement
     
    			if(source == btQuitter){
    				System.exit(0);
    			}
     
    	}
     
    }

  6. #6
    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 : 45
    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
    Par l'exception, j'entendais la stacktrace, désolé

    On pourrait avoir la stacktrace complète de l'exception? Difficile vu la taille du code de voir exactement à quelle ligne c'est lancé.

  7. #7
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    Il n'y a pas de Stack Trace...étonnant non
    Je reçois juste le message m'informant de l'erreur.

    L'exception survient quand on clique un des 7 boutons donc dans la
    procédure ActionPerformed.
    D'après ce que je comprend "il" (Hal?) ne supporte pas qu'on le quitte ou
    qu'on le ferme...!

    Je trouve quand même étrange que, je me cite,

    "...dans le message d'exception il me dit
    "contentPane cannot be set to Null"
    au lieu de
    "contentPaneF3 cannot be set to Null"
    qui est le nom du JPanel..."

    Voilà tout ce que je sais...
    Je vais essayer de passer le programme à NetBeans pour voir si je peux
    avoir un début d'explication...

  8. #8
    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 : 45
    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
    Citation Envoyé par Ylmith Voir le message
    Il n'y a pas de Stack Trace...étonnant non
    toujours afficher les stacktrace des exception qu'on attrape en dev, c'est une mine d'informations pour éviter de devoir chercher à l'aveugle.

    "...dans le message d'exception il me dit
    "contentPane cannot be set to Null"
    au lieu de
    "contentPaneF3 cannot be set to Null"
    qui est le nom du JPanel..."
    Il n'y a pas de raison, il te parle du contentPane (un attribut de JFrame) pas de tes variables.

  9. #9
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    La Stack Trace, où-est ce que je l'ai mise? Ah! La voila!

    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
     
    java.awt.IllegalComponentStateException: contentPane cannot be set to null.
    	at javax.swing.JRootPane.setContentPane(Unknown Source)
    	at javax.swing.JFrame.setContentPane(Unknown Source)
    	at ylm.JDass1.project.F4_AdmGeneral.build(F4_AdmGeneral.java:56)
    	at ylm.JDass1.project.F4_AdmGeneral.<init>(F4_AdmGeneral.java:33)
    	at ylm.JDass1.project.F3_ChoixDomaine.actionPerformed(F3_ChoixDomaine.java:436)
    	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.dispatchEventImpl(Unknown Source)
    	at java.awt.EventQueue.access$400(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.awt.EventQueue$2.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.awt.EventQueue$3.run(Unknown Source)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(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)

  10. #10
    Membre très actif Avatar de Ylmith
    Profil pro
    Powered by Laom and Bethecu
    Inscrit en
    Juin 2006
    Messages
    140
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Powered by Laom and Bethecu

    Informations forums :
    Inscription : Juin 2006
    Messages : 140
    Par défaut
    Trouvé : l'exception venait du formulaire appelé, pas du formulaire appellant.
    Le contentPane était déclaré mais pas initialisé :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    private JPanel contentPaneF4;
    au lieu de

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    private JPanel contentPaneF4 = new JPanel();
    tout simplement.

    Merci pour le conseil avec le Stack Trace, je vais en rajouter dans tous les catch...

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

Discussions similaires

  1. Set Valeur NULL dans un champs DateTime
    Par UoLad dans le forum Windows Forms
    Réponses: 6
    Dernier message: 31/07/2009, 11h47
  2. Erreur: Cannot insert the value NULL
    Par Identifiant dans le forum ASP.NET
    Réponses: 6
    Dernier message: 11/06/2007, 13h40
  3. Cannot insert the value NULL into column ...
    Par nmerydem dans le forum MS SQL Server
    Réponses: 5
    Dernier message: 18/11/2004, 10h28

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