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

Collection et Stream Java Discussion :

ArrayList<Object> + Combobox


Sujet :

Collection et Stream Java

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2013
    Messages : 5
    Par défaut ArrayList<Object> + Combobox
    Bonjour,
    voila je suis etudiant en dev, et je suis en train de codé une application de gestion de frais kilométrique. J'ai créé 3 classe, une classe Frais, une classe Ville et une classe Main.


    Classe Frais
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package FraisKm;
     
    import java.util.ArrayList;
    import java.util.Date;
     
    /**
     *
     * @author Aldric ANDRE
     */
    public class Frais {
        private Date date;
        private String destination;
        private String motif;
        private boolean forfait;
        private double txForfait;
        private double txKm;
        private double nbKm;
        private double indeKm;
        private double indeF;
     
        private ArrayList lesFrais = new ArrayList();
        public void Frais(Date d,String dest,String mo,boolean f,double eF,double km,double eKm){
            if(f=true){
     
            }
            else{
                setIndeKm(km*eKm);
            }
            this.setMotif(mo);
            this.setDestination(dest);
            this.setDate(d);
            this.setForfait(f);
            this.setTxForfait(eF);
            this.setNbKm(km);
            this.setTxKm(eKm);
            getLesFrais().add(this);
        }
     
        /**
         * @return the date
         */
        public Date getDate() {
            return date;
        }
     
        /**
         * @return the forfait
         */
        public boolean isForfait() {
            return forfait;
        }
     
     
        /**
         * @return the txForfait
         */
        public double getTxForfait() {
            return txForfait;
        }
     
        /**
         * @return the txKm
         */
        public double getTxKm() {
            return txKm;
        }
     
     
     
        /**
         * @return the indeKm
         */
        public double getIndeKm() {
            return indeKm;
        }
     
        /**
         * @return the indeF
         */
        public double getIndeF() {
            return indeF;
        }
     
        /**
         * @return the lesFrais
         */
        public ArrayList getLesFrais() {
            return lesFrais;
        }
     
        /**
         * @param date the date to set
         */
        public void setDate(Date date) {
            this.date = date;
        }
     
        /**
         * @param forfait the forfait to set
         */
        public void setForfait(boolean forfait) {
            this.forfait = forfait;
        }
     
     
        /**
         * @param txForfait the txForfait to set
         */
        public void setTxForfait(double txForfait) {
            this.txForfait = txForfait;
        }
     
        /**
         * @param txKm the txKm to set
         */
        public void setTxKm(double txKm) {
            this.txKm = txKm;
        }
     
        /**
         * @param nbKm the nbKm to set
         */
        public void setNbKm(double nbKm) {
            this.nbKm = nbKm;
        }
     
        /**
         * @param indeKm the indeKm to set
         */
        public void setIndeKm(double indeKm) {
            this.indeKm = indeKm;
        }
     
        /**
         * @param indeF the indeF to set
         */
        public void setIndeF(double indeF) {
            this.indeF = indeF;
        }
     
        /**
         * @param lesFrais the lesFrais to set
         */
        public void setLesFrais(ArrayList lesFrais) {
            this.lesFrais = lesFrais;
        }
     
        /**
         * @return the destination
         */
        public String getDestination() {
            return destination;
        }
     
        /**
         * @param destination the destination to set
         */
        public void setDestination(String destination) {
            this.destination = destination;
        }
     
        /**
         * @return the motif
         */
        public String getMotif() {
            return motif;
        }
     
        /**
         * @param motif the motif to set
         */
        public void setMotif(String motif) {
            this.motif = motif;
        }
     
    }
    Classe Ville
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package FraisKm;
     
    import java.util.ArrayList;
     
    /**
     *
     * @author Aldric ANDRE
     */
    public class Villes {
        private String nomVille;
        private double kmNancy;
        public ArrayList<Villes> lesVilles = new ArrayList<Villes>();
        public Villes(String n,double km){
            this.nomVille = n;
            this.kmNancy = km;
            lesVilles.add(this);
        }
     
        Villes Eloyes = new Villes("Eloyes (88) ",85);
        Villes Vagney = new Villes("Vagney (88)",104);
        Villes Paris = new Villes("Paris (75)",356);
        Villes Vittel = new Villes("Vittel (88)",88);
        Villes Epinal = new Villes("Epinal (88)",70);
        Villes Marly = new Villes("Marly (57)",48);
        Villes Metz = new Villes("Metz (57)",55);
        Villes FresseSurMoselle = new Villes("Fresse-sur-Moselle (88)",119);
        Villes Golbey = new Villes("Golbey (88)",65);
        Villes Brabois = new Villes("Brabois (54)",4);
        Villes VandoeuvreLesNancy = new Villes("Vandoeuvre-lès-Nancy (54)",4);
        Villes Pompey = new Villes("Pompey (54)",11);
        Villes LeTholy = new Villes("Les Tholy (88)",94);
        Villes Lille = new Villes("Lille (59)",452);
        Villes Mulhouse = new Villes("Mulhouse (68)",174);
        Villes Lyon = new Villes("Lyon (69)",403);
        Villes Ludres = new Villes("Ludres (54)",10);
        Villes Beaune = new Villes("Beaune (21)",263);
        Villes RuptSurMoselle = new Villes("Rupt-sur-Moselle (88)",105);
        Villes Hauconcourt = new Villes("Hauconcourt (57)",67);
        Villes EsseyLèsNancy = new Villes("Essey-lès-Nancy (54)",5.5);
        Villes LaBresse = new Villes("La Bresse (88)",117);
        Villes Laxou = new Villes("Laxou (54)",2.9);
        Villes Maxeville = new Villes("Maxeville (54)",3.3);
        Villes Toul = new Villes("Toul (54)",23);
        Villes VitryLeFrançois = new Villes("Vitry-le-François (51)",138);
        Villes FachesThumesnil = new Villes("Faches-Thumesnil (59)",445);
        Villes Houdemont = new Villes("Houdemont (54)",6);
        Villes Heillecourt = new Villes("Heillecourt (54)",5.1);
        Villes Fleville = new Villes("Fléville (08)",184);
        Villes Contrexeville = new Villes("Contrexeville (88)",83);
        Villes Luneville = new Villes("Lunéville (54)",33);
        Villes StEtienneLesRemiremont = new Villes("St-Etienne-lès-Remiremont (88)",96);
        Villes StDieDesVosges = new Villes("Saint-Dié-des-Vosges (88)",84);
        Villes Langes = new Villes("Langes (52)",150);
        Villes Chaumont = new Villes("Chaumont (52)",168);
        Villes Donzere = new Villes("Donzère (26)",573);
        Villes LeMans = new Villes("Le Mans (72)",580);
     
        /**
         * @return the nomVille
         */
        public String getNomVille() {
            return nomVille;
        }
     
        /**
         * @param nomVille the nomVille to set
         */
        public void setNomVille(String nomVille) {
            this.nomVille = nomVille;
        }
     
        /**
         * @return the kmNancy
         */
        public double getKmNancy() {
            return kmNancy;
        }
     
        /**
         * @param kmNancy the kmNancy to set
         */
        public void setKmNancy(double kmNancy) {
            this.kmNancy = kmNancy;
        }
     
        /**
         * @return the lesVilles
         */
        public ArrayList<Villes> getLesVilles() {
            return lesVilles;
        }
     
        /**
         * @param lesVilles the lesVilles to set
         */
        public void setLesVilles(ArrayList<Villes> lesVilles) {
            this.lesVilles = lesVilles;
        }
     
     
     
     
     
    }
    Classe MainFrame (celle qui contient le design)
    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package FraisKm;
    /**
     *
     * @author Aldric ANDRE
     */
    public class MainFrame extends javax.swing.JFrame {
        private String nom;
        private String qualification;
        /**
         * Creates new form MainFrame
         */
        public MainFrame() {
            initComponents();
        }
     
        /**
         * This method is called from within the constructor to initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is always
         * regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
     
            panelSalarie = new javax.swing.JPanel();
            txtNom = new javax.swing.JTextField();
            lblNom = new javax.swing.JLabel();
            lblQualif = new javax.swing.JLabel();
            txtQualif = new javax.swing.JTextField();
            lblDate = new javax.swing.JLabel();
            lblMois = new javax.swing.JLabel();
            cbbMois = new javax.swing.JComboBox();
            lblFormateur = new javax.swing.JLabel();
            txtFormateur = new javax.swing.JTextField();
            cbbMoisDemande = new javax.swing.JComboBox();
            txtJourDemande = new javax.swing.JTextField();
            txtAnneeDemande = new javax.swing.JTextField();
            jSeparator1 = new javax.swing.JSeparator();
            jScrollPane1 = new javax.swing.JScrollPane();
            tabDemande = new javax.swing.JTable();
            jSeparator2 = new javax.swing.JSeparator();
            dualPanel = new javax.swing.JTabbedPane();
            pKm = new javax.swing.JPanel();
            btnValiderKm = new javax.swing.JButton();
            cbAutreVille = new javax.swing.JCheckBox();
            txtAutreVille = new javax.swing.JTextField();
            lblNbKm = new javax.swing.JLabel();
            txtMotif = new javax.swing.JTextField();
            lblMotif = new javax.swing.JLabel();
            cbbVille = new javax.swing.JComboBox();
            lblVille = new javax.swing.JLabel();
            filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767));
            txtNbKm = new javax.swing.JTextField();
            pForfait = new javax.swing.JPanel();
            btnValiderForfait = new javax.swing.JButton();
            cbAutreVilleForfait = new javax.swing.JCheckBox();
            txtAutreVilleForfait = new javax.swing.JTextField();
            lblNbKmForfait = new javax.swing.JLabel();
            txtMotifForfait = new javax.swing.JTextField();
            lblMotifForfait = new javax.swing.JLabel();
            cbbVilleForfait = new javax.swing.JComboBox();
            lblVilleForfait = new javax.swing.JLabel();
            txtNbKmForfait = new javax.swing.JTextField();
            lblForfait = new javax.swing.JLabel();
            txtForfait = new javax.swing.JTextField();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            setMinimumSize(new java.awt.Dimension(440, 865));
            setResizable(false);
            setSize(new java.awt.Dimension(400, 1015));
     
            panelSalarie.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Salarié", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.DEFAULT_POSITION));
     
            txtNom.setToolTipText("");
            txtNom.setName(""); // NOI18N
     
            lblNom.setText("Nom du salarié :");
     
            lblQualif.setText("Qualification :");
     
            lblDate.setText("Date de demande :");
     
            lblMois.setText("Mois de :");
     
            cbbMois.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre" }));
     
            lblFormateur.setText("Formateur :");
     
            cbbMoisDemande.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Janvier", "Fevrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Decembre" }));
     
            org.jdesktop.layout.GroupLayout panelSalarieLayout = new org.jdesktop.layout.GroupLayout(panelSalarie);
            panelSalarie.setLayout(panelSalarieLayout);
            panelSalarieLayout.setHorizontalGroup(
                panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(panelSalarieLayout.createSequentialGroup()
                    .add(28, 28, 28)
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(panelSalarieLayout.createSequentialGroup()
                            .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(lblNom)
                                .add(lblQualif))
                            .add(18, 18, 18)
                            .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(txtQualif, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 164, Short.MAX_VALUE)
                                .add(txtNom)))
                        .add(panelSalarieLayout.createSequentialGroup()
                            .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(lblDate)
                                .add(lblMois)
                                .add(lblFormateur))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, cbbMois, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, panelSalarieLayout.createSequentialGroup()
                                    .add(txtJourDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(cbbMoisDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(txtFormateur))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(txtAnneeDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
            panelSalarieLayout.setVerticalGroup(
                panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(panelSalarieLayout.createSequentialGroup()
                    .addContainerGap()
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtNom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblNom))
                    .add(18, 18, 18)
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblQualif)
                        .add(txtQualif, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(12, 12, 12)
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblDate)
                        .add(cbbMoisDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(txtJourDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(txtAnneeDemande, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblMois)
                        .add(cbbMois, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(panelSalarieLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblFormateur)
                        .add(txtFormateur, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            );
     
            jScrollPane1.setViewportView(tabDemande);
     
            btnValiderKm.setText("Valider Frais");
     
            cbAutreVille.setText("Autre ville :");
            cbAutreVille.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cbAutreVilleActionPerformed(evt);
                }
            });
     
            txtAutreVille.setVisible(false);
            txtAutreVille.setEditable(false);
     
            lblNbKm.setVisible(false);
            lblNbKm.setText("Nb Km :");
     
            lblMotif.setText("Motif / Client :");
     
            cbbVille.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
     
            lblVille.setText("Ville :");
     
            txtNbKm.setVisible(false);
            txtNbKm.setEditable(false);
     
            org.jdesktop.layout.GroupLayout pKmLayout = new org.jdesktop.layout.GroupLayout(pKm);
            pKm.setLayout(pKmLayout);
            pKmLayout.setHorizontalGroup(
                pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(pKmLayout.createSequentialGroup()
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(pKmLayout.createSequentialGroup()
                            .add(141, 141, 141)
                            .add(btnValiderKm)
                            .add(31, 31, 31)
                            .add(filler1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(0, 0, Short.MAX_VALUE))
                        .add(pKmLayout.createSequentialGroup()
                            .add(29, 29, 29)
                            .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                .add(lblNbKm)
                                .add(cbAutreVille)
                                .add(lblMotif)
                                .add(lblVille))
                            .add(18, 18, 18)
                            .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, txtAutreVille)
                                .add(org.jdesktop.layout.GroupLayout.TRAILING, pKmLayout.createSequentialGroup()
                                    .add(0, 0, Short.MAX_VALUE)
                                    .add(txtNbKm, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(pKmLayout.createSequentialGroup()
                                    .add(txtMotif, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                    .add(0, 0, Short.MAX_VALUE))
                                .add(cbbVille, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .add(93, 93, 93))
            );
            pKmLayout.setVerticalGroup(
                pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(org.jdesktop.layout.GroupLayout.TRAILING, pKmLayout.createSequentialGroup()
                    .addContainerGap(51, Short.MAX_VALUE)
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblVille)
                        .add(cbbVille, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(18, 18, 18)
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(lblMotif)
                        .add(txtMotif, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(31, 31, 31)
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtAutreVille, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(cbAutreVille))
                    .add(4, 4, 4)
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtNbKm, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblNbKm))
                    .add(pKmLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(pKmLayout.createSequentialGroup()
                            .add(22, 22, 22)
                            .add(filler1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pKmLayout.createSequentialGroup()
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(btnValiderKm)))
                    .addContainerGap())
            );
     
            dualPanel.addTab("Kilomètre", pKm);
     
            btnValiderForfait.setText("Valider Frais");
     
            cbAutreVilleForfait.setText("Autre ville :");
            cbAutreVilleForfait.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cbAutreVilleForfaitActionPerformed(evt);
                }
            });
     
            txtAutreVilleForfait.setVisible(false);
            txtAutreVilleForfait.setEditable(false);
     
            lblNbKmForfait.setVisible(false);
            lblNbKmForfait.setText("Nb Km :");
     
            lblMotifForfait.setText("Motif / Client :");
     
            cbbVilleForfait.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cbbVilleForfaitActionPerformed(evt);
                }
            });
     
            lblVilleForfait.setText("Ville :");
     
            txtNbKmForfait.setVisible(false);
            txtNbKmForfait.setEditable(false);
     
            lblForfait.setText("Budget forfait :");
     
            org.jdesktop.layout.GroupLayout pForfaitLayout = new org.jdesktop.layout.GroupLayout(pForfait);
            pForfait.setLayout(pForfaitLayout);
            pForfaitLayout.setHorizontalGroup(
                pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(pForfaitLayout.createSequentialGroup()
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(98, 98, 98)
                            .add(lblVilleForfait)
                            .add(18, 18, 18)
                            .add(cbbVilleForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(40, 40, 40)
                            .add(lblMotifForfait)
                            .add(18, 18, 18)
                            .add(txtMotifForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(39, 39, 39)
                            .add(lblForfait)
                            .add(18, 18, 18)
                            .add(txtForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(35, 35, 35)
                            .add(cbAutreVilleForfait)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                            .add(txtAutreVilleForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(83, 83, 83)
                            .add(lblNbKmForfait)
                            .add(18, 18, 18)
                            .add(txtNbKmForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 156, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(137, 137, 137)
                            .add(btnValiderForfait)))
                    .add(87, 87, 87))
            );
            pForfaitLayout.setVerticalGroup(
                pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(pForfaitLayout.createSequentialGroup()
                    .add(18, 18, 18)
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(4, 4, 4)
                            .add(lblVilleForfait))
                        .add(cbbVilleForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(12, 12, 12)
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(pForfaitLayout.createSequentialGroup()
                            .add(6, 6, 6)
                            .add(lblMotifForfait))
                        .add(txtMotifForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblForfait))
                    .add(18, 18, 18)
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtAutreVilleForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(cbAutreVilleForfait))
                    .add(4, 4, 4)
                    .add(pForfaitLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                        .add(txtNbKmForfait, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(lblNbKmForfait))
                    .add(18, 18, 18)
                    .add(btnValiderForfait)
                    .addContainerGap())
            );
     
            dualPanel.addTab("Kilomètre", pForfait);
     
            org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(jSeparator2)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                        .add(layout.createSequentialGroup()
                            .add(panelSalarie, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(0, 8, Short.MAX_VALUE))
                        .add(jSeparator1)
                        .add(org.jdesktop.layout.GroupLayout.TRAILING, dualPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addContainerGap())
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                .add(layout.createSequentialGroup()
                    .addContainerGap()
                    .add(panelSalarie, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(dualPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 173, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(259, 259, 259))
            );
     
            pack();
        }// </editor-fold>
     
        private void cbAutreVilleActionPerformed(java.awt.event.ActionEvent evt) {                                             
            if(cbAutreVille.isSelected()==true){
                txtAutreVille.setEditable(true);
                txtAutreVille.setVisible(true);
                txtNbKm.setVisible(true);
                txtNbKm.setEditable(true);
                cbbVille.setEnabled(false);
                lblNbKm.setVisible(true);
     
            }
            if(cbAutreVille.isSelected()==false){
                txtAutreVille.setEditable(false);
                txtAutreVille.setVisible(false);
                txtNbKm.setVisible(false);
                txtNbKm.setEditable(false);
                cbbVille.setEnabled(true);
                lblNbKm.setVisible(false);
            }
        }                                            
     
        private void cbAutreVilleForfaitActionPerformed(java.awt.event.ActionEvent evt) {                                                    
            if(cbAutreVilleForfait.isSelected()==true){
                txtAutreVilleForfait.setEditable(true);
                txtAutreVilleForfait.setVisible(true);
                txtNbKmForfait.setVisible(true);
                txtNbKmForfait.setEditable(true);
                cbbVilleForfait.setEnabled(false);
                lblNbKmForfait.setVisible(true);
     
            }
            if(cbAutreVilleForfait.isSelected()==false){
                txtAutreVilleForfait.setEditable(false);
                txtAutreVilleForfait.setVisible(false);
                txtNbKmForfait.setVisible(false);
                txtNbKmForfait.setEditable(false);
                cbbVilleForfait.setEnabled(true);
                lblNbKmForfait.setVisible(false);
            }
        }                                                   
     
        private void cbbVilleForfaitActionPerformed(java.awt.event.ActionEvent evt) {
     
        }
     
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Mac OS X".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
     
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new MainFrame().setVisible(true);
                }
            });
        }
        // Variables declaration - do not modify
        private javax.swing.JButton btnValiderForfait;
        private javax.swing.JButton btnValiderKm;
        private javax.swing.JCheckBox cbAutreVille;
        private javax.swing.JCheckBox cbAutreVilleForfait;
        private javax.swing.JComboBox cbbMois;
        private javax.swing.JComboBox cbbMoisDemande;
        private javax.swing.JComboBox cbbVille;
        private javax.swing.JComboBox cbbVilleForfait;
        private javax.swing.JTabbedPane dualPanel;
        private javax.swing.Box.Filler filler1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JSeparator jSeparator1;
        private javax.swing.JSeparator jSeparator2;
        private javax.swing.JLabel lblDate;
        private javax.swing.JLabel lblForfait;
        private javax.swing.JLabel lblFormateur;
        private javax.swing.JLabel lblMois;
        private javax.swing.JLabel lblMotif;
        private javax.swing.JLabel lblMotifForfait;
        private javax.swing.JLabel lblNbKm;
        private javax.swing.JLabel lblNbKmForfait;
        private javax.swing.JLabel lblNom;
        private javax.swing.JLabel lblQualif;
        private javax.swing.JLabel lblVille;
        private javax.swing.JLabel lblVilleForfait;
        private javax.swing.JPanel pForfait;
        private javax.swing.JPanel pKm;
        private javax.swing.JPanel panelSalarie;
        private javax.swing.JTable tabDemande;
        private javax.swing.JTextField txtAnneeDemande;
        private javax.swing.JTextField txtAutreVille;
        private javax.swing.JTextField txtAutreVilleForfait;
        private javax.swing.JTextField txtForfait;
        private javax.swing.JTextField txtFormateur;
        private javax.swing.JTextField txtJourDemande;
        private javax.swing.JTextField txtMotif;
        private javax.swing.JTextField txtMotifForfait;
        private javax.swing.JTextField txtNbKm;
        private javax.swing.JTextField txtNbKmForfait;
        private javax.swing.JTextField txtNom;
        private javax.swing.JTextField txtQualif;
        // End of variables declaration
    }

    et voici un screen de mon programme



    Voila, maintenant je vous explique mon problème. Dans la classe Villes, je créé toute mes villes que je place ensuite dans une ArrayList<Villes> et je voudrais afficher les noms des villes dans les cbbVilles et cbbVillesForfait. Mais je ne sait pas du tout comment faire.
    Help me plz

  2. #2
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Tu y es presque. regarde la méthode toArray sur une ArrayList qui te permettra de transformer ta liste en tableau pour construire ton modèle.

  3. #3
    Membre Expert
    Homme Profil pro
    Directeur technique
    Inscrit en
    Janvier 2007
    Messages
    1 348
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Directeur technique

    Informations forums :
    Inscription : Janvier 2007
    Messages : 1 348
    Par défaut
    Oops, j'avais raté un élément : ta gestion de l'ArrayList des villes n'est pas bonne.
    Pour faire ce que tu veux comme ça, il faut que l'ArrayList et la méthode getLesVilles soient static (ce n'est pas une liste pour chaque objet mais bien une liste globale au niveau de la classe que tu veux).
    Ensuite, il te suffit de remplacer
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    cbbVille.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
    par
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    cbbVille.setModel(new javax.swing.DefaultComboBoxModel(Ville.getLesVilles().toArray()));
    En faisant cela, tu auras bien le menu déroulant, mais avec des textes étranges, car ce qu'affiche la combobox c'est le toString des éléments du tableau.
    Il ne te reste plus qu'à overrider la méthode toString de ville pour afficher ce que tu veux

  4. #4
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2013
    Messages : 5
    Par défaut
    Je viens de passer l'arraylist ainsi que sa methode get en static , j'ai aussi remplacer le modèle. Mais le programme ne veut pas se lancer, il me lance une erreur de compilation, lorsque que remet le code par default sur le model combobox sa compil normalement.
    En fait je crois que ma classe MainFrame ne peut pas acceder au élement de ma classe Villes. je ne sait pas pourquoi.

  5. #5
    Membre Expert
    Inscrit en
    Mai 2006
    Messages
    1 364
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 1 364
    Par défaut
    C'est quoi l'erreur de compilation ? Tu peux poster le code correspondant ?

  6. #6
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2013
    Messages : 5
    Par défaut
    Il ne fournit pas d'erreur dans les code composant, il me dit juste qu'il y a une erreur a la compilation, et que vu que j'ai rajouter que cette ligne spécifique, ça peut être que ça.
    EDIT :
    Voila le code d'erreur.
    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
     
    run:
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: Ville.getLesVilles.toArray
    	at FraisKm.MainFrame.initComponents(MainFrame.java:200)
    	at FraisKm.MainFrame.<init>(MainFrame.java:17)
    	at FraisKm.MainFrame$6.run(MainFrame.java:475)
    	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:702)
    	at java.awt.EventQueue.access$400(EventQueue.java:82)
    	at java.awt.EventQueue$2.run(EventQueue.java:663)
    	at java.awt.EventQueue$2.run(EventQueue.java:661)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    	at java.awt.EventQueue.dispatchEvent(EventQueue.java:672)
    	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    BUILD SUCCESSFUL (total time: 4 seconds)
    Le code de mon Combobox:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
     
    cbbVille = new javax.swing.JComboBox();
     
    cbbVille.setModel(new javax.swing.DefaultComboBoxModel(Ville.getLesVilles().toArray()));
     
    // Code adding the component to the parent container - not shown here

  7. #7
    Membre Expert
    Inscrit en
    Mai 2006
    Messages
    1 364
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 1 364
    Par défaut
    Ce qui aurait été interessant, c'est de donner l'erreur de compilation. Ca aurait permis de voir ou etait la faute de frappe ;-)

    Mais le mieux, c'est d'afficher le code que tu as utilisé (je dis bien copier/coller le code utilisé, pas le retaper).

  8. #8
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2013
    Messages
    5
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Meurthe et Moselle (Lorraine)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2013
    Messages : 5
    Par défaut
    je viens de la mettre l'erreur de compilation.
    ensuite cest que du copier coller

  9. #9
    Membre Expert
    Inscrit en
    Mai 2006
    Messages
    1 364
    Détails du profil
    Informations forums :
    Inscription : Mai 2006
    Messages : 1 364
    Par défaut
    A priori, tu utilises netbeans :
    http://lmgtfy.com/?q=Uncompilable+so...neous+sym+type

    Tu auras ta réponses sur à peu pres tous les liens

Discussions similaires

  1. Parcours arrayList + remove object
    Par fasyr dans le forum Collection et Stream
    Réponses: 15
    Dernier message: 08/03/2009, 16h48
  2. Tri ArrayList d'object
    Par aristeas dans le forum Collection et Stream
    Réponses: 1
    Dernier message: 21/11/2008, 17h17
  3. tri d'ArrayList d'Object[] sur un champ String
    Par igorzup dans le forum Collection et Stream
    Réponses: 6
    Dernier message: 01/10/2008, 17h49
  4. Tri d'un arrayList d'Object[]
    Par Lex92 dans le forum Collection et Stream
    Réponses: 2
    Dernier message: 24/09/2008, 16h47
  5. Obtenir un Object[][] à partir d'une ArrayList d'object[]
    Par gufra dans le forum Collection et Stream
    Réponses: 4
    Dernier message: 20/11/2007, 08h43

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