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

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

AWT/Swing Java Discussion :

Problème avec mon Panel


Sujet :

AWT/Swing Java

  1. #1
    Membre actif Avatar de aljessy
    Homme Profil pro
    Développeur Java
    Inscrit en
    Octobre 2010
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2010
    Messages : 319
    Points : 200
    Points
    200
    Par défaut Problème avec mon Panel
    Bonjour j'ai crée deux classes la première nommé Acceuil qui étend une JFrame et la seconde Ajout qui étend un JPanel et j'aimerais ajouter la classe Ajout dans la classe Acceuil mais je ne sais pas ou j'ai fais une erreur j'ai fais un
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    setContentPane(new Ajout());
    dans la classe Acceuil mais rien ne s'affiche

    voici le code des deux classe a commencer pas la classe Acceuil
    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
    package fenetre;
     
    //Bibliotheques
    import com.toedter.calendar.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.border.TitledBorder;
    import color.*;
    import controle.*;
    import java.net.MalformedURLException;
    import model.*;
    import service.*;
    import java.rmi.*;
    import java.util.*;
    import java.util.logging.*;
     
     
    public class Acceuil extends JFrame {
        private static final long serialVersionUID = 1L;
     
        private TraiteMenu men;
        private Model model;
     
        Cursor sablier = new Cursor(Cursor.HAND_CURSOR);
        ResourceBundle bundle = ResourceBundle.getBundle("ressources/Langue"); // NOI18N
     
        public Acceuil(){
            initComponents();
            setResizable(false);
            setSize(520,410);
            setLocationRelativeTo(null);
            setTitle(bundle.getString("TITLE_ACCEUIL"));
            setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
            addWindowListener(new WindowAdapter() {
                @Override 
                public void windowClosing(WindowEvent evt) {
                    formWindowClosing(evt);
                }
            });
     
     
        }
     
        private void initComponents() {
     
            //Déclaration de la barre de menu       
            BMenu = new JMenuBar();
     
            //Déclaration des menus
            file = new JMenu();
            edit = new JMenu();
            etat = new JMenu();
            aide = new JMenu();
            fonction = new JMenu();
            profil = new JMenu();
     
            //Déclaration des sous menus
            connect = new JMenuItem();
            deconnect = new JMenuItem();
            langue = new JMenuItem();
            sortie = new JMenuItem();       
            export = new JMenuItem();   
            print = new JMenuItem();
            help = new JMenuItem();
            about = new JMenuItem();
            fctadd = new JMenuItem();
            fctmod = new JMenuItem();
            fctdel = new JMenuItem();
            fctlis = new JMenuItem();
            proadd = new JMenuItem();
            promod = new JMenuItem();
            prodel = new JMenuItem();
            prolis = new JMenuItem();
     
     
            //Ajout de l'instance de la classe TraiteMenu aux sous menus et menus
            connect.addActionListener(men);
            deconnect.addActionListener(men); 
            langue.addActionListener(men);
            sortie.addActionListener(men);
            print.addActionListener(men);
            export.addActionListener(men);
            help.addActionListener(men);
            fctadd.addActionListener(men);
            fctmod.addActionListener(men);
            fctdel.addActionListener(men);
            fctlis.addActionListener(men);
            proadd.addActionListener(men);
            prodel.addActionListener(men);
            promod.addActionListener(men);
            prolis.addActionListener(men);
            about.addActionListener(men);
     
     
            file.setText(bundle.getString("FILE"));
            file.setFont(new Font("Segoe UI", 1, 12));
     
            connect.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.ALT_MASK));
            connect.setText(bundle.getString("CONNECT"));
            connect.setFont(new Font("Segoe UI", 1, 12));
            connect.setCursor(sablier);
            file.add(connect);
     
            deconnect.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.ALT_MASK));
            deconnect.setText(bundle.getString("DECONNECT"));
            deconnect.setFont(new Font("Segoe UI", 1, 12));
            deconnect.setCursor(sablier);
            file.add(deconnect);
     
            langue.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.ALT_MASK));
            langue.setText(bundle.getString("CHANGE_LANGUAGE"));
            langue.setFont(new Font("Segoe UI", 1, 12));
            langue.setCursor(sablier);
            file.add(langue);
     
            sortie.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.ALT_MASK));
            sortie.setText(bundle.getString("EXIT"));
            sortie.setFont(new Font("Segoe UI", 1, 12));
            sortie.setCursor(sablier);
            file.add(sortie);
            BMenu.add(file);
     
            edit.setText(bundle.getString("EDIT"));
            edit.setFont(new Font("Segoe UI", 1, 12));
            BMenu.add(edit);
     
            fonction.setText(bundle.getString("FONCTION"));
            fonction.setFont(new Font("Segoe UI", 1, 12));
     
            fctadd.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.ALT_MASK));
            fctadd.setText(bundle.getString("ADD"));
            fctadd.setFont(new Font("Segoe UI", 1, 12));
            fctadd.setCursor(sablier);
            fonction.add(fctadd);
     
            fctmod.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.ALT_MASK));
            fctmod.setText(bundle.getString("MODIFIED"));
            fctmod.setFont(new Font("Segoe UI", 1, 12));
            fctmod.setCursor(sablier);
            fonction.add(fctmod);
     
            fctdel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_MASK));
            fctdel.setText(bundle.getString("DELETE"));
            fctdel.setFont(new Font("Segoe UI", 1, 12));
            fctdel.setCursor(sablier);
            fonction.add(fctdel);
     
            fctlis.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.ALT_MASK));
            fctlis.setText(bundle.getString("LISTE"));
            fctlis.setFont(new Font("Segoe UI", 1, 12));
            fctlis.setCursor(sablier);
            fonction.add(fctlis);
            BMenu.add(fonction);
     
            profil.setText(bundle.getString("PROFIL"));
            profil.setFont(new Font("Segoe UI", 1, 12));
     
            proadd.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.SHIFT_MASK));
            proadd.setText(bundle.getString("ADD"));
            proadd.setFont(new Font("Segoe UI", 1, 12));
            proadd.setCursor(sablier);
            profil.add(proadd);
     
            promod.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.SHIFT_MASK));
            promod.setText(bundle.getString("MODIFIED"));
            promod.setFont(new Font("Segoe UI", 1, 12));
            promod.setCursor(sablier);
            profil.add(promod);
     
            prodel.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.SHIFT_MASK));
            prodel.setText(bundle.getString("DELETE"));
            prodel.setFont(new Font("Segoe UI", 1, 12));
            prodel.setCursor(sablier);
            profil.add(prodel);
     
            prolis.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.SHIFT_MASK));
            prolis.setText(bundle.getString("LISTE"));
            prolis.setFont(new Font("Segoe UI", 1, 12));
            prolis.setCursor(sablier);
            profil.add(prolis);
            BMenu.add(profil);
     
            etat.setText(bundle.getString("STATE"));
            etat.setFont(new Font("Segoe UI", 1, 12));
     
            print.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK));
            print.setText(bundle.getString("PRINT"));
            print.setFont(new Font("Segoe UI", 1, 12));
            print.setCursor(sablier);
            etat.add(print);
     
            export.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK));
            export.setText(bundle.getString("EXPORT"));
            export.setFont(new Font("Segoe UI", 1, 12));
            export.setCursor(sablier);
            etat.add(export);
            BMenu.add(etat);
     
            aide.setText(bundle.getString("RUBRIQUE_HELP"));
            aide.setFont(new Font("Segoe UI", 1, 12));
     
            help.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
            help.setText(bundle.getString("HELP"));
            help.setFont(new Font("Segoe UI", 1, 12));
            help.setCursor(sablier);
            aide.add(help);
     
            about.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
            about.setText(bundle.getString("ABOUT"));
            about.setFont(new Font("Segoe UI", 1, 12));
            about.setCursor(sablier);
            aide.add(about);
            BMenu.add(aide);
     
            setJMenuBar(BMenu);
            setContentPane(new Ajout());
        }
     
        /**
         * Quitter l'application.
         */
     
        private void exit() {
            int i = JOptionPane.showConfirmDialog(this, bundle.getString("QUESTION_EXIT"), 
                                                  bundle.getString("CONFIRMATION"),
                                                  JOptionPane.OK_OPTION);
     
            if (i==JOptionPane.YES_OPTION) {
                this.dispose();
                System.exit(0);
            }
        }
     
        private void formWindowClosing(WindowEvent evt) {                                   
            exit();
        }
     
     
        //Création des menus
        private JMenu file, edit, etat, aide, fonction, profil;
     
        //Création de la barre de menu
        private JMenuBar BMenu;
     
        //Création des sous menus
        private JMenuItem connect, deconnect, langue, sortie, print, export, help,
                fctadd, fctmod, fctdel, fctlis, proadd, prodel, promod, prolis, about;
     
    }
    et la classe Ajout
    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
    package fenetre;
     
    import javax.swing.*;
    import com.toedter.calendar.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.border.TitledBorder;
    import color.*;
    import controle.*;
    import java.net.MalformedURLException;
    import model.*;
    import service.*;
    import java.rmi.*;
    import java.util.*;
    import java.util.logging.*;
     
     
    public class Ajout extends JPanel {
     
        private static final long serialVersionUID = 1L;
        private TraiteBtn btn;
        private TraiteMenu men;
        private Model model;
        private Acceuil Acc;
        ArrayList<String> data = new ArrayList<String>();
        InterfaceS InterP;
        Cursor sablier = new Cursor(Cursor.HAND_CURSOR);
        ResourceBundle bundle = ResourceBundle.getBundle("ressources/Langue"); // NOI18N
     
     
        public Ajout(){
            try {
     
            //Déclaration des panels
            PChamp = new JPanel();
            PBouton = new JPanel();
            Panel1 = new JPanel();
            Panel2 = new JPanel();
            Panel3 = new JPanel();
            Panel4 = new JPanel();
            Panel5 = new JPanel();
            Panel6 = new JPanel();
            Panel7 = new JPanel();
     
            //Déclaration des labels
            LMat = new JLabel();
            LCiv = new JLabel();
            LNom = new JLabel();
            LPrenom = new JLabel();
            Lmatr = new JLabel();
            LFct = new JLabel();
            LPhone = new JLabel();
            LMobile = new JLabel();
            LMail = new JLabel();
            LDaten = new JLabel();
            Llieu = new JLabel();
            LLog = new JLabel();
            LPwd = new JLabel();
            LPro = new JLabel();
     
            //Déclaration des zones de saisie de texte
            TMat = new JTextField(10);
            TNom = new JTextField(10);       
            TPrenom = new JTextField(10);
            TMob = new JTextField(10);       
            TMail = new JTextField(10);
            TPhone = new JTextField(10);
            TLieu = new JTextField(10);
            TLog = new JTextField(10);
            TPwd = new JTextField(10);
     
            //Déclaration des combo box
            Cciv = new JComboBox(); 
            Cmatr = new JComboBox();
            Cfct = new JComboBox();
            Cpro = new JComboBox();
     
            //Déclaration des boutons
            BtAdd = new JButton(bundle.getString("ADD"));
            BtAdd.setForeground(new Couleur().COULEUR_TEXTE_BOUTON);
            BtAdd.setFont(new Font("Verdana", 1, 12));
            BtAdd.setCursor(sablier);
            BtMod = new JButton(bundle.getString("MODIFIED"));
            BtMod.setForeground(new Couleur().COULEUR_TEXTE_BOUTON);
            BtMod.setFont(new Font("Verdana", 1, 12));
            BtMod.setCursor(sablier);
            BtDel = new JButton(bundle.getString("DELETE"));
            BtDel.setForeground(new Couleur().COULEUR_TEXTE_BOUTON);
            BtDel.setFont(new Font("Verdana", 1, 12));
            BtDel.setCursor(sablier);
            BtAc = new JButton(bundle.getString("REFRESH"));
            BtAc.setForeground(new Couleur().COULEUR_TEXTE_BOUTON);
            BtAc.setFont(new Font("Verdana", 1, 12));
            BtAc.setCursor(sablier);
     
            //Déclaration d'un champ de saisie de la date
            date = new JDateChooser("dd/MM/yyyy", "##/##/####", '-');
     
            //Déclaration et instantiation des classe de controle et de model
            btn = new TraiteBtn(this, model);
     
            //Ajout l'instance de la classe TraiteBtn aux boutons
            BtAdd.addActionListener(btn);
            BtMod.addActionListener(btn);
            BtDel.addActionListener(btn);
            BtAc.addActionListener(btn);
     
            //Place le curseur dans la zone de saisie du matricule
            Acc.addWindowListener(new WindowAdapter() {
                @Override
                public void windowActivated(WindowEvent event) {
                    TMat.requestFocusInWindow();
                }
            });
     
            LMat.setText(bundle.getString("MATRICULE")+"      ");
            LMat.setForeground(new Couleur().COULEUR_TEXTE);
            LMat.setFont(new Font("Verdana", 1, 12));
            TMat.setText(null);
            TMat.setForeground(new Couleur().COULEUR_TEXTE);
            TMat.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TMat.setFont(new Font("Verdana", 1, 12));
            LMat.setLabelFor(TMat);
     
            LCiv.setText(bundle.getString("CIVILITE")+"       ");
            LCiv.setForeground(new Couleur().COULEUR_TEXTE);
            LCiv.setFont(new Font("Verdana", 1, 12));
            Cciv.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2" }));
            LCiv.setLabelFor(Cciv);
            Cciv.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            Cciv.setFont(new Font("Verdana", 1, 12));
            Cciv.setForeground(new Couleur().COULEUR_TEXTE);
     
            Panel1.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel1.setOpaque(false);
            Panel1.add(LMat);
            Panel1.add(TMat);
            Panel1.add(LCiv);
            Panel1.add(Cciv);
     
            LNom.setText(bundle.getString("NOM")+"             ");
            LNom.setForeground(new Couleur().COULEUR_TEXTE);
            LNom.setFont(new Font("Verdana", 1, 12));
            TNom.setText(null);
            TNom.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TNom.setFont(new Font("Verdana", 1, 12));
            TNom.setForeground(new Couleur().COULEUR_TEXTE);
            LNom.setLabelFor(TNom);
     
            LPrenom.setText(bundle.getString("PRENOM")+"      ");
            LPrenom.setForeground(new Couleur().COULEUR_TEXTE);
            LPrenom.setFont(new Font("Verdana", 1, 12));
            TPrenom.setText(null);
            TPrenom.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TPrenom.setFont(new Font("Verdana", 1, 12));
            TPrenom.setForeground(new Couleur().COULEUR_TEXTE);
            LPrenom.setLabelFor(TPrenom);
     
            Panel2.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel2.setOpaque(false);
            Panel2.add(LNom);
            Panel2.add(TNom);
            Panel2.add(LPrenom);
            Panel2.add(TPrenom);
     
            Lmatr.setText(bundle.getString("STATUT_MAT")+"    ");
            Lmatr.setForeground(new Couleur().COULEUR_TEXTE);
            Cmatr.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2"}));
            Lmatr.setLabelFor(Cmatr);
            Lmatr.setFont(new Font("Verdana", 1, 12));
            Cmatr.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            Cmatr.setFont(new Font("Verdana", 1, 12));
            Cmatr.setForeground(new Couleur().COULEUR_TEXTE);
     
            LFct.setText("   "+bundle.getString("FONCTION")+"     ");
            LFct.setForeground(new Couleur().COULEUR_TEXTE);
            Cfct.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2"}));
            LFct.setLabelFor(Cfct);
            LFct.setFont(new Font("Verdana", 1, 12));
            Cfct.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            Cfct.setFont(new Font("Verdana", 1, 12));
            Cfct.setForeground(new Couleur().COULEUR_TEXTE);
     
            Panel3.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel3.setOpaque(false);
            Panel3.add(Lmatr);
            Panel3.add(Cmatr);
            Panel3.add(LFct);
            Panel3.add(Cfct);
     
            LPhone.setText(bundle.getString("PHONE")+"              ");
            LPhone.setForeground(new Couleur().COULEUR_TEXTE);
            LPhone.setFont(new Font("Verdana", 1, 12));
            TPhone.setText(null);
            TPhone.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TPhone.setFont(new Font("Verdana", 1, 12));
            TPhone.setForeground(new Couleur().COULEUR_TEXTE);
            LPhone.setLabelFor(TPhone);
     
            LMobile.setText(bundle.getString("MOBILE")+"     ");
            LMobile.setForeground(new Couleur().COULEUR_TEXTE);
            LMobile.setFont(new Font("Verdana", 1, 12));
            TMob.setText(null);
            TMob.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TMob.setFont(new Font("Verdana", 1, 12));
            TMob.setForeground(new Couleur().COULEUR_TEXTE);
            LMobile.setLabelFor(TMob);
     
            Panel4.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel4.setOpaque(false);
            Panel4.add(LPhone);
            Panel4.add(TPhone);
            Panel4.add(LMobile);
            Panel4.add(TMob);
     
            LMail.setText(bundle.getString("MAIL")+"          ");
            LMail.setForeground(new Couleur().COULEUR_TEXTE);
            LMail.setFont(new Font("Verdana", 1, 12));
            TMail.setText(null);
            TMail.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TMail.setFont(new Font("Verdana", 1, 12));
            TMail.setForeground(new Couleur().COULEUR_TEXTE);
            LMail.setLabelFor(TMail);
     
            LPro.setText(" "+bundle.getString("PROFIL")+"          ");
            LPro.setForeground(new Couleur().COULEUR_TEXTE);
            LPro.setFont(new Font("Verdana", 1, 12));
            Cpro.setModel(new DefaultComboBoxModel(new String[] { "Item 1", "Item 2"}));
            Cpro.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            Cpro.setFont(new Font("Verdana", 1, 12));
            Cpro.setForeground(new Couleur().COULEUR_TEXTE);
            LPro.setLabelFor(Cpro);
     
            Panel5.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel5.setOpaque(false);
            Panel5.add(LMail);
            Panel5.add(TMail);
            Panel5.add(LPro);
            Panel5.add(Cpro);
     
            LDaten.setText(bundle.getString("DATE_NAISS")+"  ");
            LDaten.setForeground(new Couleur().COULEUR_TEXTE);
            LDaten.setFont(new Font("Verdana", 1, 12));
            LDaten.setLabelFor(date);
            date.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            date.setFont(new Font("Verdana", 1, 12));
            date.setForeground(new Couleur().COULEUR_TEXTE);
     
            Llieu.setText(bundle.getString("LIEU_NAISS"));
            Llieu.setForeground(new Couleur().COULEUR_TEXTE);
            Llieu.setLabelFor(TLieu);
            Llieu.setFont(new Font("Verdana", 1, 12));
            TLieu.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TLieu.setFont(new Font("Verdana", 1, 12));
            TLieu.setForeground(new Couleur().COULEUR_TEXTE);
            TLieu.setText(null);
     
            Panel6.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel6.setOpaque(false);
            Panel6.add(LDaten);
            Panel6.add(date);
            Panel6.add(Llieu);
            Panel6.add(TLieu);
     
            LLog.setText(bundle.getString("LOGIN")+"    ");
            LLog.setForeground(new Couleur().COULEUR_TEXTE);
            LLog.setFont(new Font("Verdana", 1, 12));
            TLog.setText(null);
            TLog.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TLog.setFont(new Font("Verdana", 1, 12));
            TLog.setForeground(new Couleur().COULEUR_TEXTE);
            LLog.setLabelFor(TLog);
     
            LPwd.setText("  "+bundle.getString("PASSWORD")+"    ");
            LPwd.setForeground(new Couleur().COULEUR_TEXTE);
            LPwd.setFont(new Font("Verdana", 1, 12));
            TPwd.setText(null);
            TPwd.setBackground(new Couleur().COULEUR_BACKGROUND_TEXTE_FIELD);
            TPwd.setFont(new Font("Verdana", 1, 12));
            TPwd.setForeground(new Couleur().COULEUR_TEXTE);
            LPwd.setLabelFor(TPwd);
     
            Panel7.setLayout(new FlowLayout(FlowLayout.LEFT));
            Panel7.setOpaque(false);
            Panel7.add(LLog);
            Panel7.add(TLog);
            Panel7.add(LPwd);
            Panel7.add(TPwd);
     
            PChamp.setLayout(new FlowLayout(FlowLayout.LEFT));
            PChamp.setPreferredSize(new Dimension(515, 350));
            PChamp.setBackground(new Couleur().COULEUR_BACKGROUND_BLOC);
            PChamp.setBorder(BorderFactory.createTitledBorder(null, bundle.getString("INFO_USER"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Verdana", 3, 12), new Couleur().COULEUR_TITRE_BORDURE));
            PChamp.add(Panel1);
            PChamp.add(Panel2);
            PChamp.add(Panel3);
            PChamp.add(Panel4);
            PChamp.add(Panel5);
            PChamp.add(Panel6);
            PChamp.add(Panel7);
     
            PBouton.setLayout(new FlowLayout(FlowLayout.CENTER));
            PBouton.setPreferredSize(new Dimension(515, 60));
            PBouton.setBorder(BorderFactory.createTitledBorder(null, bundle.getString("ACTION"), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Verdana", 3, 12), new Couleur().COULEUR_TITRE_BORDURE));
            PBouton.setBackground(new Couleur().COULEUR_BACKGROUND_BLOC);
            PBouton.add(BtAdd);
            PBouton.add(BtMod);
            PBouton.add(BtDel);
            PBouton.add(BtAc);
     
            panglo.setLayout(new FlowLayout(FlowLayout.RIGHT));
            panglo.setBorder(new TitledBorder("Adresse du client"));
            panglo.setPreferredSize(new Dimension(516, 410));
            panglo.add(PChamp);
            panglo.add(PBouton);
     
           this.add(panglo, BorderLayout.CENTER);
     
            }
            catch(Exception e){
               // e.printStackTrace();
            } 
            chargerprofil();
            chargerciv();
            chargermat();
            chargerfct();
     
        }
     
        private void chargerprofil(){
     
            //--- 
            try {
                //--- 
                InterP =(InterfaceS)Naming.lookup("rmi://localhost:1099/ServiceServeur");
                data = InterP.getAllPro();
            } 
            catch (NotBoundException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (MalformedURLException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (RemoteException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            }
     
            //--- 
            int nombre = data.size() - 1; 
            String[] ser = new String[nombre];
            for(int i=0; i<nombre; i++) {
                ser[i] = data.get(i+1);        
            }
            Cpro.setModel(new javax.swing.DefaultComboBoxModel(ser));
        }
     
        private void chargerciv(){
     
            //--- 
            try {
                //--- 
                InterP =(InterfaceS)Naming.lookup("rmi://localhost:1099/ServiceServeur");
                data = InterP.getAllCiv();
            } 
            catch (NotBoundException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (MalformedURLException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (RemoteException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            }
     
            //--- 
            int nombre = data.size() - 1; 
            String[] ser = new String[nombre];
            for(int i=0; i<nombre; i++) {
                ser[i] = data.get(i+1);        
            }
            Cciv.setModel(new javax.swing.DefaultComboBoxModel(ser));
        }
     
        private void chargermat(){
     
            //--- 
            try {
                //--- 
                InterP =(InterfaceS)Naming.lookup("rmi://localhost:1099/ServiceServeur");
                data = InterP.getAllMat();
            } 
            catch (NotBoundException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (MalformedURLException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (RemoteException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            }
     
            //--- 
            int nombre = data.size() - 1; 
            String[] ser = new String[nombre];
            for(int i=0; i<nombre; i++) {
                ser[i] = data.get(i+1);        
            }
            Cmatr.setModel(new javax.swing.DefaultComboBoxModel(ser));
        }
     
        private void chargerfct(){
     
            //--- 
            try {
                //--- 
                InterP =(InterfaceS)Naming.lookup("rmi://localhost:1099/ServiceServeur");
                data = InterP.getAllFct();
            } 
            catch (NotBoundException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (MalformedURLException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            } 
            catch (RemoteException exc) {
                Logger.getLogger(Acceuil.class.getName()).log(Level.SEVERE, null, exc);
            }
     
            //--- 
            int nombre = data.size() - 1; 
            String[] ser = new String[nombre];
            for(int i=0; i<nombre; i++) {
                ser[i] = data.get(i+1);        
            }
            Cfct.setModel(new javax.swing.DefaultComboBoxModel(ser));
        }
     
        //Création des combo box
        public JComboBox Cciv, Cmatr, Cfct, Cpro;
     
        //Création des Label
        private JLabel LMat, LDaten, LCiv, LNom, LPrenom, Lmatr, LFct, LPhone, 
                LMobile,LMail, Llieu, LLog, LPwd, LPro;
     
        //Création des panels
        private JPanel PChamp, PBouton, Panel1, Panel2, Panel3, Panel4, Panel5, 
                Panel6, Panel7, panglo;
     
        //Création des zones de saise de texte
        public JTextField TMat, TNom, TPrenom, TMob, TMail, TPhone, TLieu, TLog,
                TPwd;
     
        //Création des boutons
        public JButton BtAdd, BtMod, BtDel, BtAc;
     
        //Création d'un champs de saisie de la date
        public JDateChooser date;    
    }

  2. #2
    Membre expérimenté Avatar de Ivelios
    Homme Profil pro
    Développeur Java
    Inscrit en
    Juillet 2008
    Messages
    1 031
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 031
    Points : 1 540
    Points
    1 540
    Par défaut
    Bonjour

    Vous avez une (ou plusieurs) erreur(s) dans le constructeur de la classe Ajout.
    Mais comme vous avez placé un try/catch, l'erreur n'est pas visible.

    Enlevez le try/catch ou affichez l'erreur dans le catch.
    Vous devriez voir apparaitre l'erreur dans la console. Il ne vous reste plus qu'à la traiter.

  3. #3
    Membre actif Avatar de aljessy
    Homme Profil pro
    Développeur Java
    Inscrit en
    Octobre 2010
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Cameroun

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Octobre 2010
    Messages : 319
    Points : 200
    Points
    200
    Par défaut
    Le problème a été résolu en fait je n'avais pas déclarer le panel panglo. j'ai juste fait public et j'ai oublier et j'ai placer le code dans un bloc try / catch. Merci

  4. #4
    Membre expérimenté Avatar de Ivelios
    Homme Profil pro
    Développeur Java
    Inscrit en
    Juillet 2008
    Messages
    1 031
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ain (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 031
    Points : 1 540
    Points
    1 540
    Par défaut
    et j'ai placer le code dans un bloc try / catch.
    Justement il faut l'enlever , ça empêche de voir les erreurs s'il y en a...
    Mais l'erreur sera toujours là.

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

    Informations forums :
    Inscription : Août 2004
    Messages : 8 765
    Points : 12 977
    Points
    12 977
    Par défaut
    Citation Envoyé par Ivelios Voir le message
    Justement il faut l'enlever , ça empêche de voir les erreurs s'il y en a...
    Mais l'erreur sera toujours là.
    C'est plutôt de commenter le printStackTrace dans le bloc catch et de ne pas utiliser le Logger qui empêche de voir les erreurs...

    J'dis ça, j'dis rien ...

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

Discussions similaires

  1. Problème Avec Mon Panel
    Par halim-aman dans le forum AWT/Swing
    Réponses: 6
    Dernier message: 13/03/2008, 12h58
  2. [Mail] Problème avec mon script d'envoi de mail
    Par leroivert dans le forum Langage
    Réponses: 18
    Dernier message: 02/12/2005, 00h26
  3. Problème avec mon service mysql et PhpMyAdmin
    Par Fixazo dans le forum Outils
    Réponses: 1
    Dernier message: 28/08/2005, 18h02
  4. problème avec mon lecteur CD
    Par leo13 dans le forum Périphériques
    Réponses: 3
    Dernier message: 16/08/2005, 11h21
  5. Problème avec mon firewall ...
    Par Wis dans le forum Tomcat et TomEE
    Réponses: 15
    Dernier message: 06/04/2004, 08h46

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