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

NetBeans Java Discussion :

Problème avec JFrame Form


Sujet :

NetBeans Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Par défaut Problème avec JFrame Form
    Bonjour
    J'ai créé 2 fenêtres sous netbeans,la 1ère est une classe java qui se nomme "Login" et la 2nde se nomme "Accueil" et c'est une JFrame Form ,j'ai donc utilisé l'interface graphique de netbeans pour créer ma fenêtre "Accueil".Quand je lance mon application,la fenêtre login apparait.Si je clique sur le "ok" et que le login et le mot de passe sont bons,la fenêtre Accueil apparait.
    Le problème est :
    quand je crée le jar de mon projet(en faisant clean and build), le login apparait;mais quand je clique sur "ok",rien ne se passe.Pourtant sous netbeans tout marche bien.
    J'utilise netbeans 6.8.
    Voici mes 2 classes:

    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
    package exo;
     
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
     
     
    import javax.swing.*;
    import javax.swing.text.*;
     
    public class Login extends JFrame implements ActionListener
     
    {
    	private JPanel panLogin;
     
    	private JLabel labLogin;
    	private JLabel labPasswd;
     
    	private JTextField jtLogin;
    	private JPasswordField jtPasswd;
     
    	private JButton ok;
    	private JButton annuler;
     
     
     
    	public Login()
    	{
     
            this.setTitle("Gestion scolaire");
     
            this.setSize(350, 250);
     
            this.setLocationRelativeTo(this.getParent());
     
     
     
            //Terminer le processus lorsqu'on clique sur "Fermer"
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
     
                 //   display.setCurrentItem(monItem);
            this.setResizable(false);
     
            this.gereLogin();
            this.setVisible(true);
     
    	}
     
     
     
    	public void gereLogin()
    	{
    		panLogin=new JPanel();
    		panLogin.setLayout(null);
    		panLogin.setBounds(10, 10, 350, 250);
    		panLogin.setBackground(Color.ORANGE);
     
    		labLogin=new JLabel("Login :");
    		labLogin.setBounds(70, 50, 50, 25);
     
    		jtLogin=new JTextField();
    		jtLogin.setBounds(145, 50, 130, 25);
     
    		labPasswd=new JLabel("Password :");
    		labPasswd.setBounds(70, 100, 80, 25);
     
    		jtPasswd=new JPasswordField();
    		jtPasswd.setBounds(145, 100, 130, 25);
     
    		ok=new JButton("ok");
    		ok.setBounds(130, 150, 60, 25);
    		ok.addActionListener(this);
    		ok.setText("OK");
    ok.requestFocus();
     
     
    		ok.addKeyListener(new KeyListener() {
     
    			public void keyTyped(KeyEvent e) {
     
    			}
     
    			public void keyPressed(KeyEvent e) {
     
    			if (e.getKeyCode() == KeyEvent.VK_ENTER)
     
     
    			try {
                        sendCmd();
                    } catch (SQLException ex) {
                        Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                    }
     
    			}
     
    			public void keyReleased(KeyEvent e) {
     
    			}
     
    			});
     
     
    		annuler=new JButton("annuler");
    		annuler.setBounds(198, 150, 78, 25);
    		annuler.addActionListener(this);
    		annuler.setText("Annuler");
     
    		panLogin.add(labLogin);
    		panLogin.add(jtLogin);
    		panLogin.add(labPasswd);
    		panLogin.add(jtPasswd);
    		panLogin.add(ok);
    		panLogin.add(annuler);
     
    		this.add(panLogin);
     
    	}
     
     
    	public void sendCmd() throws SQLException
    	{
    		new Accueil();
     
                   // a.setVisible(true);
                   // this.setVisible(false);
     
     
     
    	}
     
     
     
    	@Override
    	public void actionPerformed(ActionEvent e)
    	{
    		// TODO Auto-generated method stub
    		Object o =e.getSource();
    		String log= jtLogin.getText();
    		String passe=jtPasswd.getText();
    		if(o == ok)
    		{
    			if ((log.equals("")) || (passe.equals("")))
                {
     
    				      JOptionPane.showMessageDialog(null,"Veuillez remplir les champs vides!");
    		 }
     
    			else
     
    			{
    			        if ((log.equals("niit")) && (passe.equals("passer")))
    				    {
                        try {
                            sendCmd();
                        } catch (SQLException ex) {
                            Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
                        }
    				    }
    			        else
    			        {
    			        	JOptionPane.showMessageDialog(null,"Login ou mot de passe incorrect!");
    			        }
    		    }
     
     
     
    		}
     
     
    		if(o == annuler)
    		{
    			jtLogin.setText("");
    			jtPasswd.setText("");
    		}
     
    	}
     
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    new Login();
    	}
    }

    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
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /*
     * Maison.java
     *
     * Created on 20 mai 2010, 12:41:23
     */
     
    package exo;
     
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
     
    /**
     *
     * @author Blaugrana
     */
    public class Accueil extends javax.swing.JFrame {
     
     private String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=db\\dbSudAgence.mdb;";
     private String user = "";
     private String password = "";
     
     private JOptionPane confirm;
     
        Connection con;
    PreparedStatement pst;
    Statement state;
        /** Creates new form Maison */
        public Accueil1() throws SQLException {
     
              this.setResizable(false);
              this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
             // this.setModal(true);
     
              java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
     
           this.pack();
     
           this.setLocation(
                   (screenSize.width-600)/2,
                   (screenSize.height-590)/2
                   );
           this.setSize(660, 620);
     
           this.setLocationRelativeTo(this.getParent());
     
         try {
                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     
                        } catch (ClassNotFoundException ex) {
     
                            JOptionPane.showMessageDialog(null,"Impossible de charger le pilote");
                        }
                     //   String url= "jdbc:odbc:bdSudAgence";
                       // String url ="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=bdAgence";
    //String url ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Agence\\Agence.mdb;";
     
                        con = DriverManager.getConnection(url,user,password);
     
            // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            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() {
     
            buttonGroup1 = new javax.swing.ButtonGroup();
            jPanel1 = new javax.swing.JPanel();
            labAccueil = new javax.swing.JLabel();
            panAjoutMaison = new javax.swing.JPanel();
            labAjoutMaison = new javax.swing.JLabel();
            jtQuartier = new javax.swing.JTextField();
            labAdresse = new javax.swing.JLabel();
            labQuartier = new javax.swing.JLabel();
            labPb = new javax.swing.JLabel();
            jtBp = new javax.swing.JTextField();
            labDescription = new javax.swing.JLabel();
            labVilla = new javax.swing.JLabel();
            labEtage = new javax.swing.JLabel();
            jrVilla = new javax.swing.JRadioButton();
            labTypeLoyer = new javax.swing.JLabel();
            jcTypeLoyer = new javax.swing.JComboBox();
            jrEtage = new javax.swing.JRadioButton();
            labNbrLocataire = new javax.swing.JLabel();
            jtNbrLocataire = new javax.swing.JTextField();
            boutonEnreg = new javax.swing.JButton();
            boutonAnnuler = new javax.swing.JButton();
            termeLoyer = new javax.swing.JLabel();
            jtMontantloyer = new javax.swing.JTextField();
            montantLoyer1 = new javax.swing.JLabel();
            jcTermeLoyer = new javax.swing.JComboBox();
            panBoutonGestion = new javax.swing.JPanel();
            boutonListe = new javax.swing.JButton();
            boutonGestionMaison = new javax.swing.JButton();
            boutonGestionLocataire = new javax.swing.JButton();
            boutonRetour = new javax.swing.JButton();
            menuBarGesMaison = new javax.swing.JMenuBar();
            menuFichier = new javax.swing.JMenu();
            menuEnreg = new javax.swing.JMenuItem();
            jSeparator1 = new javax.swing.JPopupMenu.Separator();
            menuQuitter = new javax.swing.JMenuItem();
            menuEdition = new javax.swing.JMenu();
            menuCopier = new javax.swing.JMenuItem();
            menuCouper = new javax.swing.JMenuItem();
            menuColler = new javax.swing.JMenuItem();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            setResizable(false);
     
            jPanel1.setBackground(new java.awt.Color(255, 255, 255));
     
            labAccueil.setFont(new java.awt.Font("Tahoma", 0, 12));
            labAccueil.setText("ACCUEIL");
     
            panAjoutMaison.setBackground(new java.awt.Color(255, 204, 153));
            panAjoutMaison.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
     
            labAjoutMaison.setText("Formulaire d'ajout d'une maison");
     
            labAdresse.setFont(new java.awt.Font("Tahoma", 1, 11));
            labAdresse.setText("Adresse ");
     
            labQuartier.setText("Quartier :");
     
            labPb.setText("BP :");
     
            jtBp.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtBpActionPerformed(evt);
                }
            });
     
            labDescription.setFont(new java.awt.Font("Tahoma", 1, 11));
            labDescription.setText("Description");
     
            labVilla.setText("Villa simple (Terrasse) :");
     
            labEtage.setText("Etages :");
     
            buttonGroup1.add(jrVilla);
            jrVilla.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jrVillaActionPerformed(evt);
                }
            });
     
            labTypeLoyer.setText("Type de loyer :");
     
            jcTypeLoyer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Loyer par chambre", "Loyer par appartement", "Loyer par chambre/Appartement", "Loyer entier(ensemble)" }));
            jcTypeLoyer.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcTypeLoyerActionPerformed(evt);
                }
            });
     
            buttonGroup1.add(jrEtage);
            jrEtage.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jrEtageActionPerformed(evt);
                }
            });
     
            labNbrLocataire.setText("Nombre de locataire(max) :");
     
            jtNbrLocataire.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtNbrLocataireActionPerformed(evt);
                }
            });
     
            boutonEnreg.setText("Enregistrer");
            boutonEnreg.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonEnregActionPerformed(evt);
                }
            });
     
            boutonAnnuler.setText("Annuler");
            boutonAnnuler.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonAnnulerActionPerformed(evt);
                }
            });
     
            termeLoyer.setText("Termes du loyer :");
     
            jtMontantloyer.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jtMontantloyerActionPerformed(evt);
                }
            });
     
            montantLoyer1.setText("Montant du loyer :");
     
            jcTermeLoyer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Mensuel", "Bimestriel", "Trimestriel", "Semestriel", "Annuel" }));
            jcTermeLoyer.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jcTermeLoyerActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout panAjoutMaisonLayout = new javax.swing.GroupLayout(panAjoutMaison);
            panAjoutMaison.setLayout(panAjoutMaisonLayout);
            panAjoutMaisonLayout.setHorizontalGroup(
                panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addGap(125, 125, 125)
                            .addComponent(labAjoutMaison))
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addGap(28, 28, 28)
                            .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(labDescription)
                                    .addComponent(termeLoyer)
                                    .addComponent(montantLoyer1)
                                    .addComponent(labNbrLocataire, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labAdresse)
                                    .addComponent(labQuartier)
                                    .addComponent(labPb)
                                    .addComponent(labVilla)
                                    .addComponent(boutonEnreg, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addComponent(labTypeLoyer))
                            .addGap(11, 11, 11)
                            .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jcTypeLoyer, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jcTermeLoyer, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jtMontantloyer, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jtNbrLocataire, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                                    .addComponent(boutonAnnuler, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, panAjoutMaisonLayout.createSequentialGroup()
                                    .addGap(23, 23, 23)
                                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(jtQuartier, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                                        .addComponent(jtBp, javax.swing.GroupLayout.DEFAULT_SIZE, 202, Short.MAX_VALUE)
                                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, panAjoutMaisonLayout.createSequentialGroup()
                                            .addComponent(jrVilla)
                                            .addGap(53, 53, 53)
                                            .addComponent(labEtage)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE)
                                            .addComponent(jrEtage)))))))
                    .addGap(29, 29, 29))
            );
            panAjoutMaisonLayout.setVerticalGroup(
                panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(labAjoutMaison)
                    .addGap(21, 21, 21)
                    .addComponent(labAdresse, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labQuartier)
                        .addComponent(jtQuartier, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(21, 21, 21)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jtBp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labPb))
                    .addGap(18, 18, 18)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addComponent(labDescription, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(labVilla, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jrVilla)
                        .addComponent(jrEtage)
                        .addComponent(labEtage))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jcTypeLoyer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(labTypeLoyer, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(labNbrLocataire, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jtNbrLocataire, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
                            .addComponent(montantLoyer1, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18))
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addGap(24, 24, 24)
                            .addComponent(jtMontantloyer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(termeLoyer, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(panAjoutMaisonLayout.createSequentialGroup()
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jcTermeLoyer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(18, 18, 18)
                    .addGroup(panAjoutMaisonLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(boutonAnnuler)
                        .addComponent(boutonEnreg))
                    .addContainerGap())
            );
     
            panBoutonGestion.setBackground(new java.awt.Color(153, 204, 255));
            panBoutonGestion.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
     
            boutonListe.setText("Liste des maisons");
            boutonListe.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonListeActionPerformed(evt);
                }
            });
     
            boutonGestionMaison.setText("Gestion Maison");
            boutonGestionMaison.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonGestionMaisonActionPerformed(evt);
                }
            });
     
            boutonGestionLocataire.setText("Gestion Locataire");
            boutonGestionLocataire.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonGestionLocataireActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout panBoutonGestionLayout = new javax.swing.GroupLayout(panBoutonGestion);
            panBoutonGestion.setLayout(panBoutonGestionLayout);
            panBoutonGestionLayout.setHorizontalGroup(
                panBoutonGestionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panBoutonGestionLayout.createSequentialGroup()
                    .addGroup(panBoutonGestionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panBoutonGestionLayout.createSequentialGroup()
                            .addContainerGap()
                            .addGroup(panBoutonGestionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(boutonGestionLocataire, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)
                                .addComponent(boutonGestionMaison, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 139, Short.MAX_VALUE)))
                        .addGroup(panBoutonGestionLayout.createSequentialGroup()
                            .addGap(14, 14, 14)
                            .addComponent(boutonListe, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)))
                    .addContainerGap())
            );
            panBoutonGestionLayout.setVerticalGroup(
                panBoutonGestionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panBoutonGestionLayout.createSequentialGroup()
                    .addGap(39, 39, 39)
                    .addComponent(boutonListe, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(42, 42, 42)
                    .addComponent(boutonGestionMaison, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                    .addComponent(boutonGestionLocataire, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(37, 37, 37))
            );
     
            boutonRetour.setText("Quitter");
            boutonRetour.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    boutonRetourActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(panAjoutMaison, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(53, 53, 53)
                                    .addComponent(boutonRetour, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                    .addGap(17, 17, 17)
                                    .addComponent(panBoutonGestion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addGap(260, 260, 260)
                            .addComponent(labAccueil)))
                    .addContainerGap(13, Short.MAX_VALUE))
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addComponent(labAccueil)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel1Layout.createSequentialGroup()
                            .addComponent(panBoutonGestion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)
                            .addComponent(boutonRetour, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(panAjoutMaison, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGap(46, 46, 46))
            );
     
            menuFichier.setText("Fichier");
     
            menuEnreg.setText("Enregistrer");
            menuFichier.add(menuEnreg);
            menuFichier.add(jSeparator1);
     
            menuQuitter.setText("Quitter");
            menuFichier.add(menuQuitter);
     
            menuBarGesMaison.add(menuFichier);
     
            menuEdition.setText("Edition");
     
            menuCopier.setText("Copier");
            menuEdition.add(menuCopier);
     
            menuCouper.setText("Couper");
            menuEdition.add(menuCouper);
     
            menuColler.setText("Coller");
            menuEdition.add(menuColler);
     
            menuBarGesMaison.add(menuEdition);
     
            setJMenuBar(menuBarGesMaison);
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
     
            pack();
        }// </editor-fold>                        
     
     
     
     
     
        private void jtBpActionPerformed(java.awt.event.ActionEvent evt) {                                     
            // TODO add your handling code here:
        }                                    
     
        private void jrEtageActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
        }                                       
     
        private void jtNbrLocataireActionPerformed(java.awt.event.ActionEvent evt) {                                               
            // TODO add your handling code here:
        }                                              
     
        private void boutonAnnulerActionPerformed(java.awt.event.ActionEvent evt) {                                              
              if(evt.getSource().equals(boutonAnnuler))
            {
     
            //  jtCode.setText("");
    						       jtQuartier.setText("");
    						       jtBp.setText("");
    						       jtNbrLocataire.setText("");
                                                           jtMontantloyer.setText("");
     
               //JOptionPane.showMessageDialog(null,"Echec de pr�paration de l'objet Prepared statement");
     
            }
     
        }                                             
     
         void quitter() {
    	    int result=confirm.showConfirmDialog(null,"Voulez vous vraiment quitter?","Gestion Etudiants",JOptionPane.YES_NO_OPTION);
    	    if(result==0){//reponse oui
     
    	      System.exit(0);
    	    }
    	    else if(result==1){//reponse non
     
    	    }
    	  }
     
        private void boutonRetourActionPerformed(java.awt.event.ActionEvent evt) {                                             
            // TODO add your handling code here:
             if(evt.getSource().equals(boutonRetour))
            {
     
     
    quitter();
                //snew Accueil();
               //JOptionPane.showMessageDialog(null,"Echec de pr�paration de l'objet Prepared statement");
     
            }
     
        }                                            
     
        private void boutonEnregActionPerformed(java.awt.event.ActionEvent evt) {                                            
            if(evt.getSource().equals(boutonEnreg)){
     
            String descripVilla = "";
            if (jrVilla.isSelected()) {
          descripVilla = "Villa simple (Terrasse)";
        }
        else {
          descripVilla = "Etages";
        }
     
         //   String code = jtCode.getText();
            String quartier = jtQuartier.getText();
            String bp = jtBp.getText();
            String nbrLocat = jtNbrLocataire.getText();
            String typeLoyer = jcTypeLoyer.getSelectedItem().toString();
            String montantLoyer = jtMontantloyer.getText();
            String termeLoyer = jcTermeLoyer.getSelectedItem().toString();
            String a = String.valueOf(0);
     
            if(   quartier.equals("")|| bp.equals("")||
    						nbrLocat.equals("")||typeLoyer.equals("") ||montantLoyer.equals("")){
    					JOptionPane.showMessageDialog(null,"Veuillez remplir les champs");
    				}
     
    				else
    				{
                    try {
                        try {
                            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     
                        } catch (ClassNotFoundException ex) {
     
                            JOptionPane.showMessageDialog(null,"Impossible de charger le pilote");
                        }
                     //   String url= "jdbc:odbc:bdSudAgence";
                       // String url ="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=bdSudAgence";
    //String url ="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=SudAgence\\sudAgence.mdb;";
     
                        con = DriverManager.getConnection(url,user,password);
     
                        pst = con.prepareStatement("insert into Maison (quartier,bp,type_villa,type_loyer,nbr_locataire_max,nbr_locataire,montant_loyer,terme_loyer) values (?,?,?,?,?,?,?,?);");
     
                      //  pst.setString(1,code);
                        pst.setString(1,quartier);
                        pst.setString(2,bp);
                        pst.setString(3,descripVilla);
                        pst.setString(4,typeLoyer);
                        pst.setString(5,nbrLocat);
                        pst.setString(6,a);
                        pst.setString(7,montantLoyer);
                        pst.setString(8,termeLoyer);
     
                        int k = pst.executeUpdate();
     
                        if(k>0)
            {
                   JOptionPane.showMessageDialog(null,"Enregistrement réussi");
    							// jtCode.setText("");
    						       jtQuartier.setText("");
    						       jtBp.setText("");
    						       jtNbrLocataire.setText("");
    						       jtMontantloyer.setText("");
            }
     
                        else
    						{
    							JOptionPane.showMessageDialog(null,"Enregistrement échoué!");
    						}
     
     
                    } catch (SQLException ex) {
                     JOptionPane.showMessageDialog(null,"Echec de pr�paration de l'objet Prepared statement");
                     System.out.println(ex.getMessage());
                    }
     
     
    				}
     
            }
     
        }                                           
     
        private void jcTypeLoyerActionPerformed(java.awt.event.ActionEvent evt) {                                            
            // TODO add your handling code here:
        }                                           
     
        private void jrVillaActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
        }                                       
     
        private void boutonListeActionPerformed(java.awt.event.ActionEvent evt) {                                            
            try {
                new ListeMaison();
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Accueil1.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Accueil1.class.getName()).log(Level.SEVERE, null, ex);
            }
        }                                           
     
        private void boutonGestionMaisonActionPerformed(java.awt.event.ActionEvent evt) {                                                    
            new GestionMaison();
        }                                                   
     
        private void jtMontantloyerActionPerformed(java.awt.event.ActionEvent evt) {                                               
            // TODO add your handling code here:
        }                                              
     
        private void jcTermeLoyerActionPerformed(java.awt.event.ActionEvent evt) {                                             
            // TODO add your handling code here:
        }                                            
     
        private void boutonGestionLocataireActionPerformed(java.awt.event.ActionEvent evt) {                                                       
           new GestionLocataire();
        }                                                      
     
     
     
     
        /**
        * @param args the command line arguments
        */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        new Accueil1().setVisible(true);
                    } catch (SQLException ex) {
                        Logger.getLogger(Accueil1.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
        }
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton boutonAnnuler;
        private javax.swing.JButton boutonEnreg;
        private javax.swing.JButton boutonGestionLocataire;
        private javax.swing.JButton boutonGestionMaison;
        private javax.swing.JButton boutonListe;
        private javax.swing.JButton boutonRetour;
        private javax.swing.ButtonGroup buttonGroup1;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPopupMenu.Separator jSeparator1;
        private javax.swing.JComboBox jcTermeLoyer;
        private javax.swing.JComboBox jcTypeLoyer;
        private javax.swing.JRadioButton jrEtage;
        private javax.swing.JRadioButton jrVilla;
        private javax.swing.JTextField jtBp;
        private javax.swing.JTextField jtMontantloyer;
        private javax.swing.JTextField jtNbrLocataire;
        private javax.swing.JTextField jtQuartier;
        private javax.swing.JLabel labAccueil;
        private javax.swing.JLabel labAdresse;
        private javax.swing.JLabel labAjoutMaison;
        private javax.swing.JLabel labDescription;
        private javax.swing.JLabel labEtage;
        private javax.swing.JLabel labNbrLocataire;
        private javax.swing.JLabel labPb;
        private javax.swing.JLabel labQuartier;
        private javax.swing.JLabel labTypeLoyer;
        private javax.swing.JLabel labVilla;
        private javax.swing.JMenuBar menuBarGesMaison;
        private javax.swing.JMenuItem menuColler;
        private javax.swing.JMenuItem menuCopier;
        private javax.swing.JMenuItem menuCouper;
        private javax.swing.JMenu menuEdition;
        private javax.swing.JMenuItem menuEnreg;
        private javax.swing.JMenu menuFichier;
        private javax.swing.JMenuItem menuQuitter;
        private javax.swing.JLabel montantLoyer1;
        private javax.swing.JPanel panAjoutMaison;
        private javax.swing.JPanel panBoutonGestion;
        private javax.swing.JLabel termeLoyer;
        // End of variables declaration                   
     
    }
    Merci

  2. #2
    Membre éclairé
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Par défaut
    coucou

  3. #3
    Expert confirmé

    Profil pro
    Fabricant et casseur d'avions
    Inscrit en
    Avril 2004
    Messages
    3 818
    Détails du profil
    Informations personnelles :
    Localisation : France, Tarn (Midi Pyrénées)

    Informations professionnelles :
    Activité : Fabricant et casseur d'avions
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Avril 2004
    Messages : 3 818
    Par défaut
    Salut

    Citation Envoyé par momjunior Voir le message
    Pourtant sous netbeans tout marche bien.
    Pas avec le code que tu as mis ici...
    Déjà une classe "Accueil" avec un constructeur "Acceuil1", c'est louche...

    Après, lance ton jar en ligne de commande, tu verras bien si tu récupères une erreur...
    "Errare humanum est, sed perseverare diabolicum"

    Ma page sur DVP.com

  4. #4
    Membre éclairé
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Par défaut
    Pas avec le code que tu as mis ici...
    Déjà une classe "Accueil" avec un constructeur "Acceuil1", c'est louche...
    C'est juste une erreur de manipulation.
    Sinon on fait comment pour lancer le jar en ligne de commande?
    Merci

  5. #5
    Expert confirmé

    Profil pro
    Fabricant et casseur d'avions
    Inscrit en
    Avril 2004
    Messages
    3 818
    Détails du profil
    Informations personnelles :
    Localisation : France, Tarn (Midi Pyrénées)

    Informations professionnelles :
    Activité : Fabricant et casseur d'avions
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Avril 2004
    Messages : 3 818
    Par défaut
    Citation Envoyé par momjunior Voir le message
    Sinon on fait comment pour lancer le jar en ligne de commande?
    c'est pas compliqué, la réponse en image
    "Errare humanum est, sed perseverare diabolicum"

    Ma page sur DVP.com

  6. #6
    Membre éclairé
    Inscrit en
    Juin 2005
    Messages
    578
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 578
    Par défaut
    ok j'ai lancé le jar en ligne de commande et j'ai l'erreur suivante:

    java.sql.SQLException: [Microsoft][Pilote ODBC Microsoft Access] '<Inconnu>' n'est pas un chemin d'accés valide. Assurez-vous que le nom du chemin d'accés est correct et qu'une connexion est établie avec le serveur sur lequel réside le fichier.
    C'est apparemment un problème de pilote,mais j'avais lu quelque part qu'il faut créer un répertoire "lib" dans le dist et insérer le pilote sinon ça ne marchera pas.Mais avec access,il n'existe pas de pilote .jar je crois!Par-contre c'est une source de données qu'on doit créer n'est ce pas.

    Mais bizarrement j'ai jamais créé de source de données mais pourtant j'ai pu exécuter mon application sous netbeans.Mais c'est quand j'essaie d'exécuter le jar que ça ne reconnait pas le pilote.

    J'imagine donc que je dois créer la source de données (n'est ce pas?)mais quelque chose me tracasse:si je crée la source sur mon ordinateur et que je souhaite partager mon application avec un ami qui souhaite l'utiliser sur sa machine,sera t' il obligé de créer une nouvelle source de données sur sa machine?

  7. #7
    Membre émérite Avatar de fraco
    Profil pro
    Inscrit en
    Juin 2006
    Messages
    750
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Juin 2006
    Messages : 750
    Par défaut
    Salut !

    Si tu peux exécuter le programme dans netbeans mais pas au dehors c'est peut-être dans l'URL : remplace

    DBQ=db\\dbSudAgence.mdb;";
    par une adresse valide par exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    DBQ=C:\\ACCESS\\dbSudAgence.mdb;";
    l'autre façon c'est effectivement de définir une source de donnée, comme ça :

    Il faut créer une nouvelle source de donnée depuis le panneau de configuration windows --> Outils d'administration --> Sources de données (ODBC)
    dans l'onglet source de données système clique sur le buttons ajouter choisis le driver de microsoft access (puis clic sur Terminer)
    donne un nom "Nom de la source de donnée" par ex. HDI voir plus bas
    clic sur "Sélectionner" aller chercher la base de données visée (fichier .mdb)

    dans le code java tu mettra le même nom de la ressource dans l'url par exemple si ta source est nomme "HDI"
    donc l'url de la connexion à la base de donnée s'écrira : String url = "jdbc:odbc:HDI";


    conseil pour finir : si tu n'est pas absolument obligé d'utiliser ACCESS choisis un autre système !

Discussions similaires

  1. Problème avec la Form Principale
    Par zagmoh dans le forum C++Builder
    Réponses: 3
    Dernier message: 10/06/2007, 23h15
  2. Problème avec document.forms
    Par Kernald dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 25/02/2007, 12h15
  3. Problème avec HTML::Form
    Par Woufeil dans le forum Web
    Réponses: 1
    Dernier message: 05/06/2006, 13h59
  4. problème avec les forms 6i!
    Par JauB dans le forum Oracle
    Réponses: 2
    Dernier message: 07/11/2005, 08h33

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