Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
- at tp2.MainPage.jList1ValueChanged(MainPage.java:231)
- at tp2.MainPage.access$300(MainPage.java:24)
- at tp2.MainPage$4.valueChanged(MainPage.java:106)
- private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {
- String npays = "null",titre= "null",nacteurPrincipal= "null",oscar= "null",realisateur= "null";
- try {
- String url = "jdbc:mysql://localhost/mycinema";
- Class.forName("com.mysql.jdbc.Driver");
- Connection connexion = DriverManager.getConnection(url, "root", "");
- Statement inst = connexion.createStatement();
- titre = jList1.getSelectedValue().toString(); //LINE 231
- ResultSet resultat = inst.executeQuery("SELECT * FROM film WHERE titre = '" + titre + "'");
- while (resultat.next()) {
- npays = resultat.getString("npays");
- realisateur = resultat.getString("realisateur");
- nacteurPrincipal = resultat.getString("nacteurPrincipal");
- oscar = resultat.getString("oscar");
- }
- resultat = inst.executeQuery("SELECT * FROM pays WHERE npays =" + npays);
- while (resultat.next()) {
- npays = resultat.getString("nom");
- }
- resultat = inst.executeQuery("SELECT * FROM acteur WHERE nacteur =" + nacteurPrincipal);
- while (resultat.next()) {
- nacteurPrincipal = resultat.getString("prenom") + resultat.getString("nom");
- }
- jTextArea3.setText(titre + " : un film par " + realisateur + "n" + npays);
- } catch (ClassNotFoundException ex) {
- Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
- } catch (SQLException ex) {
- Logger.getLogger(MainPage.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement