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

Interfaces Graphiques en Java Discussion :

XML ne fonctionne pas


Sujet :

Interfaces Graphiques en Java

  1. #1
    Membre averti
    Inscrit en
    Juin 2009
    Messages
    46
    Détails du profil
    Informations forums :
    Inscription : Juin 2009
    Messages : 46
    Par défaut XML ne fonctionne pas
    bonjour
    j arrive pas à créer mon fichier et voir mes données saisies !!!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /*
     * Draw_window.java
     *
     * Created on 21 févr. 2011, 20:09:41
     */
    package transformertoxml;
    // import transformertoxml.Xml_File.*;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.OutputStream;
    import java.io.Writer;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JComboBox.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.output.Format;
    import org.jdom.output.XMLOutputter;
     
    /**
     *
     * @author Nahla
     */
    public class Draw_window extends javax.swing.JFrame {
     
        /** Creates new form Draw_window */
        public Draw_window() {
            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() {
            bindingGroup = new org.jdesktop.beansbinding.BindingGroup();
     
            jLabel1 = new javax.swing.JLabel();
            class_var = new javax.swing.JTextField();
            add_att = new javax.swing.JButton();
            jLabel3 = new javax.swing.JLabel();
            add_class = new javax.swing.JButton();
            jLabel4 = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
            affich1 = new javax.swing.JTextArea();
            att_var = new javax.swing.JTextField();
            method = new javax.swing.JTextField();
            add_meth = new javax.swing.JButton();
            acces_class = new javax.swing.JComboBox();
            class_container = new javax.swing.JComboBox();
            jLabel20 = new javax.swing.JLabel();
            jLabel21 = new javax.swing.JLabel();
            jLabel22 = new javax.swing.JLabel();
            class_value = new javax.swing.JComboBox();
            jLabel26 = new javax.swing.JLabel();
            acces_att = new javax.swing.JComboBox();
            jLabel27 = new javax.swing.JLabel();
            acces_meth = new javax.swing.JComboBox();
            jLabel28 = new javax.swing.JLabel();
            type_meth = new javax.swing.JComboBox();
            jLabel29 = new javax.swing.JLabel();
            type_att = new javax.swing.JComboBox();
            jLabel2 = new javax.swing.JLabel();
            jLabel5 = new javax.swing.JLabel();
            fromClass = new javax.swing.JComboBox();
            toClass = new javax.swing.JComboBox();
            jLabel10 = new javax.swing.JLabel();
            jLabel6 = new javax.swing.JLabel();
            cardFrom = new javax.swing.JComboBox();
            jLabel11 = new javax.swing.JLabel();
            cardTo = new javax.swing.JComboBox();
            jLabel13 = new javax.swing.JLabel();
            action = new javax.swing.JTextField();
            btnExport = new javax.swing.JButton();
            classType = new javax.swing.JComboBox();
            jLabel23 = new javax.swing.JLabel();
            add_meth1 = new javax.swing.JButton();
            typeCard = new javax.swing.JComboBox();
            jLabel7 = new javax.swing.JLabel();
            jLabel30 = new javax.swing.JLabel();
            menuBar = new javax.swing.JMenuBar();
            fileMenu = new javax.swing.JMenu();
            openMenuItem = new javax.swing.JMenuItem();
            saveMenuItem = new javax.swing.JMenuItem();
            saveAsMenuItem = new javax.swing.JMenuItem();
            exitMenuItem = new javax.swing.JMenuItem();
            editMenu = new javax.swing.JMenu();
            cutMenuItem = new javax.swing.JMenuItem();
            copyMenuItem = new javax.swing.JMenuItem();
            pasteMenuItem = new javax.swing.JMenuItem();
            deleteMenuItem = new javax.swing.JMenuItem();
            helpMenu = new javax.swing.JMenu();
            contentsMenuItem = new javax.swing.JMenuItem();
            aboutMenuItem = new javax.swing.JMenuItem();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowOpened(java.awt.event.WindowEvent evt) {
                    formWindowOpened(evt);
                }
            });
     
            jLabel1.setText("1.Class name");
     
            class_var.setText(" ");
            class_var.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    class_varActionPerformed(evt);
                }
            });
     
            add_att.setText("Add");
            add_att.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_attActionPerformed(evt);
                }
            });
     
            jLabel3.setText("3. Attribut");
     
            add_class.setText("Add");
            add_class.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_classActionPerformed(evt);
                }
            });
     
            jLabel4.setText("4. Method");
     
            affich1.setColumns(20);
            affich1.setRows(5);
            affich1.setMargin(new java.awt.Insets(5, 5, 5, 5));
            jScrollPane1.setViewportView(affich1);
     
            att_var.setText(" ");
            att_var.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    att_varActionPerformed(evt);
                }
            });
     
            method.setText(" ");
            method.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    methodActionPerformed(evt);
                }
            });
     
            add_meth.setText("Add");
            add_meth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_methActionPerformed(evt);
                }
            });
     
            acces_class.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "public", "private", "protected" }));
     
            org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, acces_class, org.jdesktop.beansbinding.ObjectProperty.create(), acces_class, org.jdesktop.beansbinding.BeanProperty.create("elements"));
            bindingGroup.addBinding(binding);
            binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, acces_class, org.jdesktop.beansbinding.ObjectProperty.create(), acces_class, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
            bindingGroup.addBinding(binding);
     
            acces_class.addItemListener(new java.awt.event.ItemListener() {
                public void itemStateChanged(java.awt.event.ItemEvent evt) {
                    acces_classItemStateChanged(evt);
                }
            });
            acces_class.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    acces_classActionPerformed(evt);
                }
            });
     
            class_container.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "extends", "implements", "          " }));
            class_container.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    class_containerActionPerformed(evt);
                }
            });
     
            jLabel20.setForeground(new java.awt.Color(102, 0, 102));
            jLabel20.setText("Access control  class");
     
            jLabel21.setForeground(new java.awt.Color(102, 0, 102));
            jLabel21.setText("Container");
     
            jLabel22.setForeground(new java.awt.Color(102, 0, 102));
            jLabel22.setText("Container value");
     
            class_value.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
     
            jLabel26.setForeground(new java.awt.Color(102, 0, 102));
            jLabel26.setText("Access control  attribut");
     
            acces_att.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "public", "private", "protected" }));
            acces_att.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    acces_attActionPerformed(evt);
                }
            });
     
            jLabel27.setForeground(new java.awt.Color(102, 0, 102));
            jLabel27.setText("Access control method");
     
            acces_meth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "public", "private", "protected" }));
            acces_meth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    acces_methActionPerformed(evt);
                }
            });
     
            jLabel28.setForeground(new java.awt.Color(102, 0, 102));
            jLabel28.setText("Type method");
     
            type_meth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "void", "boolean", "byte", "char", "double", "float", "int", "long", "String", "short" }));
            type_meth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    type_methActionPerformed(evt);
                }
            });
     
            jLabel29.setForeground(new java.awt.Color(102, 0, 102));
            jLabel29.setText("Type attribut");
     
            type_att.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "boolean", "byte", "char", "double", "float", "int", "long", "String", "short" }));
            type_att.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    type_attActionPerformed(evt);
                }
            });
     
            jLabel2.setText("* les relations & les associations");
     
            jLabel5.setText("From");
     
            jLabel10.setText("To");
     
            jLabel6.setText("Cardinality");
     
            cardFrom.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "n" }));
     
            jLabel11.setText("To");
     
            cardTo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "n" }));
     
            jLabel13.setText("Action");
     
            btnExport.setText("Exporter");
            btnExport.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    btnExportActionPerformed(evt);
                }
            });
     
            classType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Class", "Interface" }));
     
            jLabel23.setForeground(new java.awt.Color(102, 0, 102));
            jLabel23.setText("Type");
     
            add_meth1.setText("Add");
            add_meth1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    add_meth1ActionPerformed(evt);
                }
            });
     
            typeCard.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Navigation", "Association", "Composition", "Dependency", "Agregation", "Generalisation" }));
     
            jLabel7.setText("Type");
     
            jLabel30.setForeground(new java.awt.Color(102, 0, 102));
            jLabel30.setText("Access control  method");
     
            fileMenu.setText("File");
     
            openMenuItem.setText("Open");
            fileMenu.add(openMenuItem);
     
            saveMenuItem.setText("Save");
            fileMenu.add(saveMenuItem);
     
            saveAsMenuItem.setText("Save As ...");
            fileMenu.add(saveAsMenuItem);
     
            exitMenuItem.setText("Exit");
            exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    exitMenuItemActionPerformed(evt);
                }
            });
            fileMenu.add(exitMenuItem);
     
            menuBar.add(fileMenu);
     
            editMenu.setText("Edit");
     
            cutMenuItem.setText("Cut");
            editMenu.add(cutMenuItem);
     
            copyMenuItem.setText("Copy");
            editMenu.add(copyMenuItem);
     
            pasteMenuItem.setText("Paste");
            editMenu.add(pasteMenuItem);
     
            deleteMenuItem.setText("Delete");
            editMenu.add(deleteMenuItem);
     
            menuBar.add(editMenu);
     
            helpMenu.setText("Help");
     
            contentsMenuItem.setText("Contents");
            helpMenu.add(contentsMenuItem);
     
            aboutMenuItem.setText("About");
            helpMenu.add(aboutMenuItem);
     
            menuBar.add(helpMenu);
     
            setJMenuBar(menuBar);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(btnExport)
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                            .addGap(9, 9, 9)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(jLabel6)
                                                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGap(31, 31, 31)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(cardFrom, 0, 45, Short.MAX_VALUE)
                                                            .addGap(78, 78, 78)
                                                            .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(action, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(jLabel7)
                                                        .addComponent(jLabel5))
                                                    .addGap(18, 18, 18)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(typeCard, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(fromClass, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGap(34, 34, 34)))
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGap(12, 12, 12)
                                                    .addComponent(cardTo, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
                                                    .addComponent(add_meth1, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(75, 75, 75))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                    .addComponent(toClass, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 81, Short.MAX_VALUE))))
                                        .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addComponent(jLabel4)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(method, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(class_var))
                                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                            .addComponent(att_var, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                    .addGap(6, 6, 6)))
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel20)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                            .addGroup(layout.createSequentialGroup()
                                                                .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                                .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(jLabel26))
                                                        .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel30))
                                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                        .addComponent(type_att, 0, 101, Short.MAX_VALUE)
                                                        .addComponent(acces_att, 0, 101, Short.MAX_VALUE)
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                            .addComponent(acces_meth, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(acces_class, 0, 101, Short.MAX_VALUE)
                                                            .addComponent(classType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(class_container, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                            .addComponent(class_value, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                        .addComponent(type_meth, 0, 101, Short.MAX_VALUE)))
                                                .addComponent(jLabel23)
                                                .addComponent(jLabel21, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel22, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(18, 18, 18)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(add_att)
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                        .addComponent(add_meth)
                                                        .addGap(57, 57, 57))
                                                    .addComponent(add_class)))))
                                    .addGap(6, 6, 6))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 633, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(45, 45, 45))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
                            .addGap(18, 18, 18)
                            .addComponent(btnExport))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(32, 32, 32)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(class_var, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jLabel23)
                                        .addComponent(jLabel1))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel21)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(jLabel22))
                                .addGroup(layout.createSequentialGroup()
                                    .addContainerGap()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel20)
                                        .addComponent(acces_class, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(classType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(class_container, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(class_value, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(48, 48, 48)
                                    .addComponent(add_class)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGap(31, 31, 31)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel26)
                                                .addComponent(acces_att, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(type_att, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel29)))
                                        .addGroup(layout.createSequentialGroup()
                                            .addGap(39, 39, 39)
                                            .addComponent(add_att)))
                                    .addGap(7, 7, 7)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addGroup(layout.createSequentialGroup()
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGap(12, 12, 12)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(jLabel4)
                                                        .addComponent(method, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addGroup(layout.createSequentialGroup()
                                                    .addGap(11, 11, 11)
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                        .addComponent(acces_meth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel30))))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(jLabel27)
                                                .addComponent(jLabel28)
                                                .addComponent(type_meth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGroup(layout.createSequentialGroup()
                                            .addGap(22, 22, 22)
                                            .addComponent(add_meth))))
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(28, 28, 28)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLabel3)
                                        .addComponent(att_var, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGap(8, 8, 8)
                            .addComponent(jLabel2)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(typeCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel7))
                            .addGap(8, 8, 8)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(fromClass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(toClass, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel10)
                                .addComponent(jLabel5))
                            .addGap(18, 18, 18)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel6)
                                .addComponent(cardFrom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel11)
                                .addComponent(cardTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(add_meth1))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel13)
                                .addComponent(action, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap())
            );
     
            acces_class.getAccessibleContext().setAccessibleParent(acces_class);
     
            bindingGroup.bind();
     
            pack();
        }// </editor-fold>
     
        private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
            System.exit(0);
        }                                            
     
        private void class_varActionPerformed(java.awt.event.ActionEvent evt) {                                          
            // TODO add your handling code here:
            String enter = class_var.getText();  // e
     
        }                                         
     
        private void add_classActionPerformed(java.awt.event.ActionEvent evt) {                                          
            ///////////////////////
            Classe classe = new Classe();
            classe.attributs = new ArrayList<Attribut>();
            classe.methodes = new ArrayList<Methode>();
            classe.nom = class_var.getText();
            classe.accessControl = (String) acces_class.getSelectedItem();
            classe.container = (String) class_container.getSelectedItem();
            classe.containerValue = (String) class_value.getSelectedItem();
            indexClasses++;
            classe.id = String.valueOf(indexClasses + 1);
            classes.add(classe);
     
            ////////////////////
            // TODO add your handling code here:
            String sortie1 = null;
            sortie1 = class_var.getText();
     
            // liste class acces
            String class_slected = "";
            class_slected = class_slected + acces_class.getSelectedItem().toString();
            // liste container
            String container_slected = "";
            container_slected = container_slected + class_container.getSelectedItem().toString();
            String vide = (String) class_container.getSelectedItem();
            //affichage
            if (vide == null) {
                container_slected = "aucun";
                affich1.append("Class name : " + sortie1 + " \n Acces control class :" + class_slected + "\nContainer :" + container_slected);
            } else {
                affich1.append("class name : " + sortie1 + " \n acces control class :" + class_slected + "\ncontainer :" + container_slected);
            }
            // affich1.
            affich1.setEditable(false);
     
            recharger();
        }                                         
        /**
         * 
         */
        public void recharger() {
            fromClass.removeAllItems();
            toClass.removeAllItems();
            for (int i = 0; i < classes.size(); i++) {
                fromClass.addItem(classes.get(i).nom);
                toClass.addItem(classes.get(i).nom);
            }
        }
        private void att_varActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
            String attribut = att_var.getText(); // recuperer valeur de attribut saisi
     
     
    }                                       
     
        private void add_attActionPerformed(java.awt.event.ActionEvent evt) {                                        
     
            //////////////////////
            Attribut attribut = new Attribut();
            attribut.accesControl = (String) acces_att.getSelectedItem();
            attribut.typeAttribut = (String) type_att.getSelectedItem();
            classes.get(indexClasses).attributs.add(attribut);
            /////////////////////
     
            // TODO add your handling code here:
            // nom d class saisi
            String sortie1 = null;
            sortie1 = att_var.getText();
            // liste attribut acces
            String att_slected = "";
            att_slected = att_slected + acces_att.getSelectedItem().toString();
            // type attribut
            String type_att_slected = "";
            type_att_slected = type_att_slected + type_att.getSelectedItem().toString();
            /*
            //affichage
            affich1.append("Attribut : "+ sortie1+ " \n acces control class :"+class_slected+"\ncontainer :"+container_slected);
     
            affich1.setEditable(false);
             * */
            affich1.append("\nAttribut: " + sortie1 + "\nAcces control attribut: " + att_slected + "\nType attribut: " + type_att_slected);
            affich1.setEditable(false);
        }                                       
     
        private void methodActionPerformed(java.awt.event.ActionEvent evt) {                                       
            // TODO add your handling code here:
            String enter3 = method.getText();
        }                                      
     
        private void add_methActionPerformed(java.awt.event.ActionEvent evt) {                                         
     
            //////////////////////
            Methode methode = new Methode();
            methode.accesControl = (String) acces_meth.getSelectedItem();
            methode.typeMethode = (String) type_meth.getSelectedItem();
            classes.get(indexClasses).methodes.add(methode);
            /////////////////////
     
     
            // TODO add your handling code here:
            // nom methode saisi
            String sortie1 = null;
            sortie1 = method.getText();
            // acces method
            String method_slected = "";
            method_slected = method_slected + acces_meth.getSelectedItem().toString();
            // recuperer type methode ( valeur de retour)
            String type_meth_slected = "";
            type_meth_slected = type_meth_slected + type_meth.getSelectedItem().toString();
            //
            affich1.append("\nMethod name:" + sortie1 + "\nAcces control method: " + method_slected + "\nType method: " + type_meth_slected);
        }                                        
     
        private void acces_attActionPerformed(java.awt.event.ActionEvent evt) {                                          
            // TODO add your handling code here:
            String att_slected = "";
            // att_slected =
    }                                         
     
        private void acces_classActionPerformed(java.awt.event.ActionEvent evt) {                                            
            // TODO add your handling code here:
            // access_class.addItem("");
     
            // acces_class.addItem(possibleValues);
            String class_slected = "";
            class_slected = class_slected + acces_class.getSelectedItem().toString();
     
     
        }                                           
        // recupere cet element
        // String str = (String)combo.getSelectedItem();
        // recuperer tout les Jcombobox
     
        // public String getAccess_class(){return (String) acces_class  ;}
        private void acces_classItemStateChanged(java.awt.event.ItemEvent evt) {                                             
            // TODO add your handling code here:
            // String str_class = (String) access_class.getSlectedItem();
        }                                            
     
        private void class_containerActionPerformed(java.awt.event.ActionEvent evt) {                                                
            // TODO add your handling code here:
     
            String container_slected = "";
            container_slected = container_slected + class_container.getSelectedItem().toString();
    }                                               
     
        private void type_attActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
            // recuperer valeur selctionée
            String type_att_slected = "";
            type_att_slected = type_att_slected + type_att.getSelectedItem().toString();
        }                                        
     
        private void acces_methActionPerformed(java.awt.event.ActionEvent evt) {                                           
            // TODO add your handling code here:
            String method_slected = "";
            method_slected = method_slected + acces_meth.getSelectedItem().toString();
        }                                          
     
        private void type_methActionPerformed(java.awt.event.ActionEvent evt) {                                          
            // TODO add your handling code here:
            // recuperer type methode ( valeur de retour)
            String type_meth_slected = "";
            type_meth_slected = type_meth_slected + type_meth.getSelectedItem().toString();
        }                                         
     
        private void btnExportActionPerformed(java.awt.event.ActionEvent evt) {                                          
     
            try {
    //l'element root du document xml
                Element root = new Element("Diagram");
                root.setAttribute("name", "Diagramme_Test");
                Document doc = new Document(root);
                Element nodeClasses = new Element("classes");
                for (int i = 0; i < classes.size(); i++) {
                    //un noeud classe
                    Element nodeClass = new Element("classe");
                    nodeClass.setAttribute("id", classes.get(i).id);
                    nodeClass.setAttribute("name", classes.get(i).nom);
     
                    nodeClass.setAttribute("access", classes.get(i).accessControl);
                    nodeClass.setAttribute("container", classes.get(i).container);
                    nodeClass.setAttribute("containerValue", classes.get(i).containerValue);
                    // Ajouter les attributs
                    if (classes.get(i).attributs.size() > 0) {
                        Element nodeAttributs = new Element("attributs");
                        for (int j = 0; j < classes.get(i).attributs.size(); j++) {
                            //un noeud classe
                            Element nodeAttribut = new Element("attribut");
                            nodeAttribut.setAttribute("access", classes.get(i).attributs.get(j).accesControl);
                            nodeAttribut.setAttribute("type", classes.get(i).attributs.get(j).typeAttribut);
                            nodeAttributs.addContent(nodeAttribut);
                        }
                        nodeClass.addContent(nodeAttributs);
                    }
                    // Ajouter les méthodes
                    if (classes.get(i).methodes.size() > 0) {
                        Element nodeMethodes = new Element("methodes");
                        for (int j = 0; j < classes.get(i).methodes.size(); j++) {
                            //un noeud classe
                            Element nodeMethode = new Element("methode");
                            nodeMethode.setAttribute("accessControl", classes.get(i).methodes.get(j).accesControl);
                            nodeMethode.setAttribute("type", classes.get(i).methodes.get(j).typeMethode);
                            nodeMethodes.addContent(nodeMethode);
                        }
                        nodeClass.addContent(nodeMethodes);
                    }
                    nodeClasses.addContent(nodeClass);
                    root.addContent(nodeClasses);
                }
                if (cardinalites.size() > 0) {
                    Element nodeCardinalites = new Element("cardinalites");
                    for (int i = 0; i < cardinalites.size(); i++) {
                        Element nodeCardinalite = new Element("relation");
     
                        nodeCardinalite.setAttribute("type", cardinalites.get(i).type);
                        nodeCardinalite.setAttribute("start", cardinalites.get(i).cardinalityFrom);
                        nodeCardinalite.setAttribute("end", cardinalites.get(i).cardinalityTo);
                        nodeCardinalite.setAttribute("action", cardinalites.get(i).action);
                        Element nodeSource = new Element("source");
                        nodeSource.setAttribute("reference", cardinalites.get(i).fromClass);
                        Element nodeTarget = new Element("target");
                        nodeTarget.setAttribute("reference", cardinalites.get(i).fromClass);
     
                        nodeCardinalite.addContent(nodeSource);
                        nodeCardinalite.addContent(nodeTarget);
                        nodeCardinalites.addContent(nodeCardinalite);
     
                    }
                    root.addContent(nodeCardinalites);
                }
                enregistre("Diagramme_Test.xml", doc);
     
            } catch (Throwable e) {
                e.printStackTrace();
            }
     
        }                                         
     
        /**
         * 
         * @param fichier
         * @param document
         */
        void enregistre(String fichier, Document document) {
            try {
                //On utilise ici un affichage classique avec getPrettyFormat()
                XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
                //Remarquez qu'il suffit simplement de créer une instance de FileOutputStream
                //avec en argument le nom du fichier pour effectuer la sérialisation.
                sortie.output(document, new FileOutputStream(fichier));
            } catch (java.io.IOException e) {
            }
        }
     
        private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
            classes = new ArrayList<Classe>();
            cardinalites = new ArrayList<Cardinalite>();
        }                                 
     
        private void add_meth1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
            Cardinalite cardinalite = new Cardinalite();
            cardinalite.fromClass = (String) fromClass.getSelectedItem();
            cardinalite.toClass = (String) toClass.getSelectedItem();
            cardinalite.cardinalityFrom = (String) cardFrom.getSelectedItem();
            cardinalite.cardinalityTo = (String) cardTo.getSelectedItem();
            cardinalite.type = (String) typeCard.getSelectedItem();
            cardinalite.action = action.getText();
            cardinalites.add(cardinalite);
        }                                         
     
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
     
                public void run() {
                    new Draw_window().setVisible(true);
                }
            });
        }
        List <Classe> classes;
        List <Cardinalite> cardinalites;
        int indexClasses = -1;
        int indexCardinalites = -1;
        // Variables declaration - do not modify
        private javax.swing.JMenuItem aboutMenuItem;
        private javax.swing.JComboBox acces_att;
        private javax.swing.JComboBox acces_class;
        private javax.swing.JComboBox acces_meth;
        private javax.swing.JTextField action;
        private javax.swing.JButton add_att;
        private javax.swing.JButton add_class;
        private javax.swing.JButton add_meth;
        private javax.swing.JButton add_meth1;
        private javax.swing.JTextArea affich1;
        private javax.swing.JTextField att_var;
        private javax.swing.JButton btnExport;
        private javax.swing.JComboBox cardFrom;
        private javax.swing.JComboBox cardTo;
        private javax.swing.JComboBox classType;
        private javax.swing.JComboBox class_container;
        private javax.swing.JComboBox class_value;
        private javax.swing.JTextField class_var;
        private javax.swing.JMenuItem contentsMenuItem;
        private javax.swing.JMenuItem copyMenuItem;
        private javax.swing.JMenuItem cutMenuItem;
        private javax.swing.JMenuItem deleteMenuItem;
        private javax.swing.JMenu editMenu;
        private javax.swing.JMenuItem exitMenuItem;
        private javax.swing.JMenu fileMenu;
        private javax.swing.JComboBox fromClass;
        private javax.swing.JMenu helpMenu;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel10;
        private javax.swing.JLabel jLabel11;
        private javax.swing.JLabel jLabel13;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel20;
        private javax.swing.JLabel jLabel21;
        private javax.swing.JLabel jLabel22;
        private javax.swing.JLabel jLabel23;
        private javax.swing.JLabel jLabel26;
        private javax.swing.JLabel jLabel27;
        private javax.swing.JLabel jLabel28;
        private javax.swing.JLabel jLabel29;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel30;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel7;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JMenuBar menuBar;
        private javax.swing.JTextField method;
        private javax.swing.JMenuItem openMenuItem;
        private javax.swing.JMenuItem pasteMenuItem;
        private javax.swing.JMenuItem saveAsMenuItem;
        private javax.swing.JMenuItem saveMenuItem;
        private javax.swing.JComboBox toClass;
        private javax.swing.JComboBox typeCard;
        private javax.swing.JComboBox type_att;
        private javax.swing.JComboBox type_meth;
        private org.jdesktop.beansbinding.BindingGroup bindingGroup;
        // End of variables declaration
    }
    et l'erreur c' :
    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
     
     
    org.jdom.IllegalAddException: The Content already has an existing parent "Diagram"
            at org.jdom.ContentList.add(ContentList.java:209)
            at org.jdom.ContentList.add(ContentList.java:131)
            at java.util.AbstractList.add(AbstractList.java:91)
            at org.jdom.Element.addContent(Element.java:811)
            at transformertoxml.Draw_window.btnExportActionPerformed(Draw_window.java:770)
            at transformertoxml.Draw_window.access$1400(Draw_window.java:29)
            at transformertoxml.Draw_window$15.actionPerformed(Draw_window.java:259)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6216)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5981)
            at java.awt.Container.processEvent(Container.java:2041)
            at java.awt.Component.dispatchEventImpl(Component.java:4583)
            at java.awt.Container.dispatchEventImpl(Container.java:2099)
            at java.awt.Component.dispatchEvent(Component.java:4413)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4556)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4220)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4150)
            at java.awt.Container.dispatchEventImpl(Container.java:2085)
            at java.awt.Window.dispatchEventImpl(Window.java:2475)
            at java.awt.Component.dispatchEvent(Component.java:4413)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

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

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

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    avant d'ajouter un noeud à un nouveau parent, il faut le détacher du parent précédent, car un noeud ne peut avoir qu'un seul parent en xml.

Discussions similaires

  1. Linq XML ne fonctionne pas
    Par Alice23 dans le forum Windows Phone
    Réponses: 7
    Dernier message: 26/12/2011, 10h32
  2. [Flex4] remplir datagrid avec xml ne fonctionne pas
    Par xclue dans le forum Flex
    Réponses: 5
    Dernier message: 13/04/2011, 21h57
  3. [AJAX] ajax et xml ne fonctionnant pas sous Firefox
    Par Phpdebut dans le forum AJAX
    Réponses: 7
    Dernier message: 03/02/2010, 12h15
  4. Javascript + XML : ne fonctionne pas du tout
    Par prgasp77 dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 03/10/2007, 16h54
  5. [AJAX] Parsage XML ne fonctionne pas sous IE!
    Par webrider dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 25/03/2007, 19h50

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