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

 Java Discussion :

ouvrir un JDialog avec un bouton


Sujet :

Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    35
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 35
    Par défaut ouvrir un JDialog avec un bouton
    Bonjour,
    J'ai fait deux JDialog j'aimerez que lorsque l'on clique sur un bouton qui se trouve dans le JDIalog, s'ouvre alors un autre JDialog.

    Voici le code de mon JDialogue 1
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    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
     
    import javax.swing.ImageIcon;
     
    public class Activités extends java.awt.Dialog {
     
       public int activite;
        public Activités(java.awt.Frame parent, boolean modal,int num) {
            super(parent, modal);
     
            initComponents();
            activite=num;
            if(activite==1)
            {ImageIcon icon = new ImageIcon(this.getClass().getResource("toureiffel.jpg"));
             ImageIcon icon2 = new ImageIcon(this.getClass().getResource("arcdetriomphe.jpg"));
             ImageIcon icon3 = new ImageIcon(this.getClass().getResource("nddp.jpg"));
             Imag1.setIcon(icon);
             Imag2.setIcon(icon2);
             Imag3.setIcon(icon3);
             Imag4.setVisible(false);
             Text1.setText("Tour Eiffel");
             Text2.setText("Arc de Triomphe");
             Text3.setText("Notre-Dame de Paris");
             Text4.setVisible(false);
             Choisir4.setVisible(false);
             Info4.setVisible(false);
            }
            if(activite==2)
            {ImageIcon icon = new ImageIcon(this.getClass().getResource("batomouche.jpg"));
             ImageIcon icon2 = new ImageIcon(this.getClass().getResource("jardin.jpg"));
             ImageIcon icon3 = new ImageIcon(this.getClass().getResource("nddp.jpg"));
             Imag1.setIcon(icon);
             Imag2.setIcon(icon2);
             Imag3.setIcon(icon3);
             Imag4.setVisible(false);
             Text1.setText("Bateau-mouche");
             Text2.setText("Jardin des Plantes");
             Text3.setText("...");
             Text4.setVisible(false);
             Choisir4.setVisible(false);
             Info4.setVisible(false);
            }            
            if(activite==3)
            {ImageIcon icon = new ImageIcon(this.getClass().getResource("louvre.jpg"));
             ImageIcon icon2 = new ImageIcon(this.getClass().getResource("grevin.jpg"));
             ImageIcon icon3 = new ImageIcon(this.getClass().getResource("histnat.jpg"));
             Imag1.setIcon(icon);
             Imag2.setIcon(icon2);
             Imag3.setIcon(icon3);
             Imag4.setVisible(false);
             Text1.setText("Louvre");
             Text2.setText("Musée Grevin");
             Text3.setText("Musée d'Histoire Naturelle");
             Text4.setVisible(false);
             Choisir4.setVisible(false);
             Info4.setVisible(false);
            }            
            if(activite==4)
            {ImageIcon icon = new ImageIcon(this.getClass().getResource("toureiffel.jpg"));
             ImageIcon icon2 = new ImageIcon(this.getClass().getResource("arcdetriomphe.jpg"));
             ImageIcon icon3 = new ImageIcon(this.getClass().getResource("nddp.jpg"));
             Imag1.setIcon(icon);
             Imag2.setIcon(icon2);
             Imag3.setIcon(icon3);
             Imag4.setVisible(false);
             Text1.setText("??");
             Text2.setText("??");
             Text3.setText("??");
             Text4.setVisible(false);
             Choisir4.setVisible(false);
             Info4.setVisible(false);
            }
        }
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            jPanel1 = new javax.swing.JPanel();
            jPanel5 = new javax.swing.JPanel();
            Text1 = new javax.swing.JLabel();
            Info1 = new javax.swing.JButton();
            Choisir1 = new javax.swing.JButton();
            Imag1 = new javax.swing.JButton();
            jPanel3 = new javax.swing.JPanel();
            Imag2 = new javax.swing.JButton();
            jPanel6 = new javax.swing.JPanel();
            Text2 = new javax.swing.JLabel();
            Info2 = new javax.swing.JButton();
            Choisir2 = new javax.swing.JButton();
            jPanel4 = new javax.swing.JPanel();
            jPanel7 = new javax.swing.JPanel();
            Text3 = new javax.swing.JLabel();
            Info3 = new javax.swing.JButton();
            Choisir3 = new javax.swing.JButton();
            Imag3 = new javax.swing.JButton();
            jPanel2 = new javax.swing.JPanel();
            jPanel8 = new javax.swing.JPanel();
            Text4 = new javax.swing.JLabel();
            Info4 = new javax.swing.JButton();
            Choisir4 = new javax.swing.JButton();
            Imag4 = new javax.swing.JButton();
     
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    closeDialog(evt);
                }
            });
            setLayout(new java.awt.GridLayout(2, 2));
     
            jPanel1.setLayout(new java.awt.BorderLayout());
     
            Text1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            Text1.setText("Texte1");
     
            Info1.setText("+ d'info");
            Info1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
            Info1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    Info1ActionPerformed(evt);
                }
            });
     
            Choisir1.setText("Choisir");
     
            javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
            jPanel5.setLayout(jPanel5Layout);
            jPanel5Layout.setHorizontalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGap(72, 72, 72)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(Choisir1)
                        .addComponent(Info1))
                    .addContainerGap(59, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                    .addContainerGap(91, Short.MAX_VALUE)
                    .addComponent(Text1)
                    .addGap(75, 75, 75))
            );
            jPanel5Layout.setVerticalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addComponent(Text1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(Info1)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Choisir1))
            );
     
            jPanel1.add(jPanel5, java.awt.BorderLayout.SOUTH);
     
            Imag1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
            jPanel1.add(Imag1, java.awt.BorderLayout.CENTER);
     
            add(jPanel1);
     
            jPanel3.setLayout(new java.awt.BorderLayout());
            jPanel3.add(Imag2, java.awt.BorderLayout.CENTER);
     
            Text2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            Text2.setText("Texte2");
     
            Info2.setText("+ d'info");
            Info2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
     
            Choisir2.setText("Choisir");
     
            javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
            jPanel6.setLayout(jPanel6Layout);
            jPanel6Layout.setHorizontalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addGap(72, 72, 72)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(Choisir2)
                        .addComponent(Info2))
                    .addContainerGap(59, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                    .addContainerGap(91, Short.MAX_VALUE)
                    .addComponent(Text2)
                    .addGap(75, 75, 75))
            );
            jPanel6Layout.setVerticalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addComponent(Text2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(Info2)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Choisir2))
            );
     
            jPanel3.add(jPanel6, java.awt.BorderLayout.SOUTH);
     
            add(jPanel3);
     
            jPanel4.setLayout(new java.awt.BorderLayout());
     
            Text3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            Text3.setText("Texte3");
     
            Info3.setText("+ d'info");
            Info3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
     
            Choisir3.setText("Choisir");
     
            javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
            jPanel7.setLayout(jPanel7Layout);
            jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addGap(72, 72, 72)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(Choisir3)
                        .addComponent(Info3))
                    .addContainerGap(59, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                    .addContainerGap(91, Short.MAX_VALUE)
                    .addComponent(Text3)
                    .addGap(75, 75, 75))
            );
            jPanel7Layout.setVerticalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel7Layout.createSequentialGroup()
                    .addComponent(Text3)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(Info3)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Choisir3))
            );
     
            jPanel4.add(jPanel7, java.awt.BorderLayout.SOUTH);
            jPanel4.add(Imag3, java.awt.BorderLayout.CENTER);
     
            add(jPanel4);
     
            jPanel2.setLayout(new java.awt.BorderLayout());
     
            Text4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            Text4.setText("Texte4");
     
            Info4.setText("+ d'info");
            Info4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
     
            Choisir4.setText("Choisir");
     
            javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
            jPanel8.setLayout(jPanel8Layout);
            jPanel8Layout.setHorizontalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(72, 72, 72)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(Choisir4)
                        .addComponent(Info4))
                    .addContainerGap(59, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                    .addContainerGap(91, Short.MAX_VALUE)
                    .addComponent(Text4)
                    .addGap(75, 75, 75))
            );
            jPanel8Layout.setVerticalGroup(
                jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addComponent(Text4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(Info4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(Choisir4))
            );
     
            jPanel2.add(jPanel8, java.awt.BorderLayout.SOUTH);
            jPanel2.add(Imag4, java.awt.BorderLayout.CENTER);
     
            add(jPanel2);
     
            pack();
        }// </editor-fold>                        
     
        /** Closes the dialog */
        private void closeDialog(java.awt.event.WindowEvent evt) {                             
            setVisible(false);
            dispose();
        }                            
     
        private void Info1ActionPerformed(java.awt.event.ActionEvent evt) {                                      
        Info dial;
         dial=new Info(this,true);
         dial.setVisible(true);
        }                                     
     
        /**
        * @param args the command line arguments
        */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    Activités dialog = new Activités(new java.awt.Frame(), true,0);
     
                    dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                        public void windowClosing(java.awt.event.WindowEvent e) {
                            System.exit(0);
                        }
                    });
                    dialog.setVisible(true);
                }
            });
        }
     
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton Choisir1;
        private javax.swing.JButton Choisir2;
        private javax.swing.JButton Choisir3;
        private javax.swing.JButton Choisir4;
        private javax.swing.JButton Imag1;
        private javax.swing.JButton Imag2;
        private javax.swing.JButton Imag3;
        private javax.swing.JButton Imag4;
        private javax.swing.JButton Info1;
        private javax.swing.JButton Info2;
        private javax.swing.JButton Info3;
        private javax.swing.JButton Info4;
        private javax.swing.JLabel Text1;
        private javax.swing.JLabel Text2;
        private javax.swing.JLabel Text3;
        private javax.swing.JLabel Text4;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JPanel jPanel3;
        private javax.swing.JPanel jPanel4;
        private javax.swing.JPanel jPanel5;
        private javax.swing.JPanel jPanel6;
        private javax.swing.JPanel jPanel7;
        private javax.swing.JPanel jPanel8;
        // End of variables declaration                   
     
    }
     
    Voici celui de mon deuxieme JDialog
     
    public class Info extends java.awt.Dialog {
     
        /** Creates new form Info */
        public Info(java.awt.Dialog Parent, boolean modal) {
            super(Parent,modal);
            initComponents();
        }
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
        private void initComponents() {
     
            jPanel1 = new javax.swing.JPanel();
            jButton1 = new javax.swing.JButton();
            jButton2 = new javax.swing.JButton();
            jPanel2 = new javax.swing.JPanel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
            jPanel3 = new javax.swing.JPanel();
            jLabel1 = new javax.swing.JLabel();
            jPanel4 = new javax.swing.JPanel();
            jButton4 = new javax.swing.JButton();
            jButton6 = new javax.swing.JButton();
            jButton5 = new javax.swing.JButton();
            jButton7 = new javax.swing.JButton();
            jLabel2 = new javax.swing.JLabel();
            jTextField1 = new javax.swing.JTextField();
     
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    closeDialog(evt);
                }
            });
            setLayout(new java.awt.GridLayout(3, 1));
     
            jPanel1.setLayout(new java.awt.GridLayout(1, 3));
     
            jButton1.setText("jButton1");
            jPanel1.add(jButton1);
     
            jButton2.setText("jButton2");
            jPanel1.add(jButton2);
     
            add(jPanel1);
     
            jPanel2.setLayout(new java.awt.GridLayout());
     
            jTextArea1.setColumns(20);
            jTextArea1.setRows(5);
            jTextArea1.setMinimumSize(new java.awt.Dimension(32767, 32767));
            jScrollPane1.setViewportView(jTextArea1);
     
            jPanel2.add(jScrollPane1);
     
            add(jPanel2);
     
            jPanel3.setLayout(new javax.swing.BoxLayout(jPanel3, javax.swing.BoxLayout.X_AXIS));
     
            jLabel1.setText("Choisissez une heure pour la visite guidée");
            jPanel3.add(jLabel1);
     
            jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));
     
            jButton4.setText("jButton4");
            jPanel4.add(jButton4);
     
            jButton6.setText("jButton6");
            jPanel4.add(jButton6);
     
            jButton5.setText("jButton5");
            jPanel4.add(jButton5);
     
            jButton7.setText("jButton7");
            jPanel4.add(jButton7);
     
            jPanel3.add(jPanel4);
     
            jLabel2.setText(" ou indiquer une heure ");
            jPanel3.add(jLabel2);
     
            jTextField1.setMaximumSize(new java.awt.Dimension(2147483647, 20));
            jPanel3.add(jTextField1);
     
            add(jPanel3);
     
            pack();
        }// </editor-fold>                        
     
        /** Closes the dialog */
        private void closeDialog(java.awt.event.WindowEvent evt) {                             
            setVisible(false);
            dispose();
        }                            
     
        /**
        * @param args the command line arguments
        */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    Info dialog = new Info(new java.awt.Frame(), true);
                    dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                        public void windowClosing(java.awt.event.WindowEvent e) {
                            System.exit(0);
                        }
                    });
                    dialog.setVisible(true);
                }
            });
        }
     
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton4;
        private javax.swing.JButton jButton5;
        private javax.swing.JButton jButton6;
        private javax.swing.JButton jButton7;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JPanel jPanel3;
        private javax.swing.JPanel jPanel4;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JTextField jTextField1;
        // End of variables declaration                   
     
    }
    En fait c le
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public Info(java.awt.Dialog Parent, boolean modal) {
            super(Parent,modal);
            initComponents();
    de Info qui ne va pas il me mette
    cannot find symbol
    symbol: Constuctor (java.awt.Dialog, boolean)
    location: class java.awt.Dialog
    Aidez moi s'il vous plait

  2. #2
    Membre émérite
    Avatar de bpy1401
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2003
    Messages
    511
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2003
    Messages : 511
    Par défaut
    Bonjour Gio89

    Premier point, il y a une balise code qui permet de mettre en forme ton code dans un post, cela permet d'être plus lisible d'augmenter les chances de réponses.

    Ton problème viens du fait que, dans ton code, il n'y a pas de constructeur
    qui convient

    tu fais appel à

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Info dialog = new Info(new java.awt.Frame(), true);
    et tu as comme constructeur possible

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public Info(java.awt.Dialog Parent, boolean modal)
    Une classe Dialog n'est pas une Frame,

    Autre chose, évite les caractères accentués dans les classe
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public class Activités extends java.awt.Dialog
    Bonne correction
    Page sur Developpez : http://pbriand.developpez.com

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Mars 2010
    Messages
    35
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2010
    Messages : 35
    Par défaut
    Bonjour,
    déjà je voulais te dire merci de ta reponce
    par contre cela ne marche pas

    j'ai mis ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Info dialog = new Info(new java.awt.Dialog(), true);
    et cela ne marche pas car il ne reconnait pas la fonction Dialog() dans java.awt

    ensuite le probleme vien aussi de

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    public Info(java.awt.Dialog Parent, boolean modal) {
            super(Parent,modal);
            initComponents();
    ou il me disent
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    symbol: Constuctor (java.awt.Dialog, boolean)
    location: class java.awt.Dialog
    merci de m'aider

  4. #4
    Membre émérite
    Avatar de bpy1401
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mars 2003
    Messages
    511
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : France, Eure (Haute Normandie)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Mars 2003
    Messages : 511
    Par défaut
    re bonjour gio89

    C'est normal, je t'avais dis ou cela n'allait pas, mais pas comment corriger.

    Ton problème se situe dans le fait que tu appel ton constructeur Info soit avec une classe Frame soit avec une classe Dialog, mais tu n'a défini qu'un seul constructeur qui accepte qu'une classe Dialog.

    Tu dois donc écrire un deuxième constructeur qui lui acceptera un objet de type Frame comme ceci

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    public class Info extends java.awt.Dialog {
     
      /** Creates new form Info */
      public Info(java.awt.Frame Parent, boolean modal) {
        super(Parent,modal);
        initComponents();
      }
     
      public Info(java.awt.Dialog Parent,boolean modal) {
        super(Parent);
        setModal(modal);
        initComponents();
      }
    A+
    Page sur Developpez : http://pbriand.developpez.com

Discussions similaires

  1. [C#]Ouvrir l'explorer avec un bouton
    Par titve dans le forum Windows Forms
    Réponses: 3
    Dernier message: 27/10/2007, 19h48
  2. Ouvrir un outil avec un bouton
    Par faine dans le forum IHM
    Réponses: 3
    Dernier message: 31/08/2007, 15h45
  3. Ouvrir un TPageControl avec un bouton
    Par Gizmo-grenat dans le forum Composants VCL
    Réponses: 2
    Dernier message: 26/04/2006, 12h57
  4. Ouvrir une frame avec un bouton dans une frame
    Par argon dans le forum AWT/Swing
    Réponses: 1
    Dernier message: 25/03/2006, 10h48
  5. [Eclipse 3.1] ouvrir une fenetre avec un bouton
    Par Nanoulov dans le forum SWT/JFace
    Réponses: 4
    Dernier message: 01/08/2005, 13h33

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