Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: unknown error

  1. #1
    Junior Member
    Join Date
    Aug 2019
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default unknown error

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    given this error on my preparedStatement
     
    /*
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */
    package hospitalmanagementsystem;
     
    import java.sql.Connection;
    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.JOptionPane;
     
    /**
     *
     * @author scisco
     */
    public class adminPanel extends javax.swing.JFrame {
    Connection conn ;
    Statement st;
     
        /**
         * Creates new form adminPanel
         */
        public adminPanel(Connection con , Statement st) {
            this.conn=con;
            this.st=st;
            initComponents();
        }
    PreparedStatement pst;
        /**
         * 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() {
     
            jPanel1 = new javax.swing.JPanel();
            jPanel2 = new javax.swing.JPanel();
            jLabel2 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jLabel1 = new javax.swing.JLabel();
            jPanel3 = new javax.swing.JPanel();
            jLabel7 = new javax.swing.JLabel();
            jLabel8 = new javax.swing.JLabel();
            jLabel9 = new javax.swing.JLabel();
            jLabel10 = new javax.swing.JLabel();
            jLabel11 = new javax.swing.JLabel();
            jPanel4 = new javax.swing.JPanel();
            jLabel3 = new javax.swing.JLabel();
            jButton3 = new javax.swing.JButton();
            jPanel5 = new javax.swing.JPanel();
            jLabel4 = new javax.swing.JLabel();
            jButton2 = new javax.swing.JButton();
            jPanel6 = new javax.swing.JPanel();
            jLabel5 = new javax.swing.JLabel();
            jButton4 = new javax.swing.JButton();
            jPanel7 = new javax.swing.JPanel();
            jLabel6 = new javax.swing.JLabel();
            jTextField1 = new javax.swing.JTextField();
            jButton5 = new javax.swing.JButton();
            jTextField2 = new javax.swing.JTextField();
            jTextField3 = new javax.swing.JTextField();
            jLabel12 = new javax.swing.JLabel();
            jLabel13 = new javax.swing.JLabel();
            jLabel14 = new javax.swing.JLabel();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setMaximumSize(new java.awt.Dimension(960, 660));
            setMinimumSize(new java.awt.Dimension(960, 660));
            setUndecorated(true);
            setPreferredSize(new java.awt.Dimension(960, 660));
     
            jPanel1.setPreferredSize(new java.awt.Dimension(960, 660));
            jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
     
            jPanel2.setBackground(new java.awt.Color(100, 240, 240));
            jPanel2.setPreferredSize(new java.awt.Dimension(960, 100));
            jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
     
            jLabel2.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
            jLabel2.setForeground(new java.awt.Color(255, 255, 255));
            jLabel2.setText("ADMIN DASHBORD");
            jPanel2.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 30, 310, 50));
     
            jButton1.setBackground(new java.awt.Color(255, 255, 255));
            jButton1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
            jButton1.setForeground(new java.awt.Color(100, 240, 240));
            jButton1.setText("LOGOUT");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });
            jPanel2.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(730, 30, 120, 50));
     
            jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 80, 1110, -1));
     
            jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospitalmanagementsystem/images/indexj.jpg"))); // NOI18N
            jLabel1.setText("jLabel1");
            jLabel1.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(100, 240, 240), 2, true));
            jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 80, 110, 100));
     
            jPanel3.setBackground(new java.awt.Color(100, 240, 240));
     
            jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospitalmanagementsystem/images/indexi.png"))); // NOI18N
            jLabel7.setText("jLabel7");
     
            jLabel8.setText("ID:");
     
            jLabel9.setText("NAME :");
     
            jLabel10.setText("PHONE NUMBER :");
     
            jLabel11.setText("EMAIL :");
     
            javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
            jPanel3.setLayout(jPanel3Layout);
            jPanel3Layout.setHorizontalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addGap(35, 35, 35)
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(44, Short.MAX_VALUE))
            );
            jPanel3Layout.setVerticalGroup(
                jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(48, 48, 48)
                    .addComponent(jLabel8)
                    .addGap(28, 28, 28)
                    .addComponent(jLabel9)
                    .addGap(29, 29, 29)
                    .addComponent(jLabel10)
                    .addGap(27, 27, 27)
                    .addComponent(jLabel11)
                    .addGap(0, 399, Short.MAX_VALUE))
            );
     
            jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 220, 230, 730));
     
            jPanel4.setBackground(new java.awt.Color(255, 255, 255));
     
            jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospitalmanagementsystem/images/indexhy.jpg"))); // NOI18N
            jLabel3.setText("jLabel3");
     
            jButton3.setBackground(new java.awt.Color(100, 240, 240));
            jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
            jButton3.setForeground(new java.awt.Color(255, 255, 255));
            jButton3.setText("Patient details");
            jButton3.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton3ActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
            jPanel4.setLayout(jPanel4Layout);
            jPanel4Layout.setHorizontalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addGap(38, 38, 38)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(43, Short.MAX_VALUE))
                .addComponent(jButton3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
            jPanel4Layout.setVerticalGroup(
                jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(7, 7, 7))
            );
     
            jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 270, 200, 160));
     
            jPanel5.setBackground(new java.awt.Color(255, 255, 255));
     
            jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospitalmanagementsystem/images/indexfgg.jpg"))); // NOI18N
            jLabel4.setText("jLabel4");
     
            jButton2.setBackground(new java.awt.Color(100, 240, 240));
            jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
            jButton2.setForeground(new java.awt.Color(255, 255, 255));
            jButton2.setText("Receptionist");
            jButton2.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton2ActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
            jPanel5.setLayout(jPanel5Layout);
            jPanel5Layout.setHorizontalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addGap(41, 41, 41)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(41, Short.MAX_VALUE))
            );
            jPanel5Layout.setVerticalGroup(
                jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel5Layout.createSequentialGroup()
                    .addContainerGap(15, Short.MAX_VALUE)
                    .addComponent(jLabel4)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
            );
     
            jPanel1.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 270, 190, 160));
     
            jPanel6.setBackground(new java.awt.Color(255, 255, 255));
     
            jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/hospitalmanagementsystem/images/indexfff.png"))); // NOI18N
            jLabel5.setText("jLabel5");
     
            jButton4.setBackground(new java.awt.Color(100, 240, 240));
            jButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
            jButton4.setForeground(new java.awt.Color(255, 255, 255));
            jButton4.setText("Doctor details");
            jButton4.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton4ActionPerformed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
            jPanel6.setLayout(jPanel6Layout);
            jPanel6Layout.setHorizontalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(32, 32, 32))
            );
            jPanel6Layout.setVerticalGroup(
                jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
            );
     
            jPanel1.add(jPanel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 270, 180, 160));
     
            jPanel7.setBackground(new java.awt.Color(100, 240, 240));
     
            jLabel6.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
            jLabel6.setForeground(new java.awt.Color(255, 0, 0));
            jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
            jLabel6.setText("X");
            jLabel6.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mousePressed(java.awt.event.MouseEvent evt) {
                    jLabel6MousePressed(evt);
                }
            });
     
            javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
            jPanel7.setLayout(jPanel7Layout);
            jPanel7Layout.setHorizontalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
            );
            jPanel7Layout.setVerticalGroup(
                jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            );
     
            jPanel1.add(jPanel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(910, 0, 50, 40));
            jPanel1.add(jTextField1, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 570, 240, -1));
     
            jButton5.setBackground(new java.awt.Color(100, 240, 240));
            jButton5.setForeground(new java.awt.Color(255, 255, 255));
            jButton5.setText("Upload new deases");
            jButton5.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton5ActionPerformed(evt);
                }
            });
            jPanel1.add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 600, 140, -1));
            jPanel1.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 540, 240, -1));
            jPanel1.add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(660, 510, 240, -1));
     
            jLabel12.setText("disease type :");
            jPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 510, 80, 20));
     
            jLabel13.setText("specialist :");
            jPanel1.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 538, 70, 20));
     
            jLabel14.setText("symptoms :");
            jPanel1.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(550, 570, 80, 20));
     
            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, 1230, Short.MAX_VALUE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE))
            );
     
            pack();
        }// </editor-fold>                        
     
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           adminLogin al= new adminLogin(conn ,st);
           al.setVisible(true);
        }                                        
     
        private void jLabel6MousePressed(java.awt.event.MouseEvent evt) {                                     
           System.exit(0);
        }                                    
     
        private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           NewReceptionist nr= new NewReceptionist();
           nr.setVisible(true);
           this.dispose();
        }                                        
     
        private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           NewDoctor nd= new NewDoctor();
           nd.setVisible(true);
           this.dispose();
        }                                        
     
        private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
           NewPatient np= new NewPatient();
           np.setVisible(true);
           this.dispose();
        }                                        
     
        private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     
            String sql = "insert into diseases values (?,?,?)";
        try {
            pst=conn.prepareStatement(sql);
     
        } catch (SQLException ex) {
            Logger.getLogger(adminPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
     
         try{     
              pst.setString(2,jTextField3.getText());
              pst.setString(3,jTextField2.getText());
              pst.setString(1,jTextField1.getText()); 
              System.out.println(jTextField3.getText());
              System.out.println(jTextField2.getText());
              System.out.println(jTextField1.getText());
              pst.executeUpdate();
     
              JOptionPane.showMessageDialog(this,"data succesfully inserted");
          }catch (Exception e){
     
              JOptionPane.showMessageDialog(null,"data not succesful");
              e.printStackTrace();
          }
        }                                        
     
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            /* Set the Nimbus look and feel */
            //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
            /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
             * For details see [url]http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html[/url] 
             */
            try {
                for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                    if ("Nimbus".equals(info.getName())) {
                        javax.swing.UIManager.setLookAndFeel(info.getClassName());
                        break;
                    }
                }
            } catch (ClassNotFoundException ex) {
                java.util.logging.Logger.getLogger(adminPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (InstantiationException ex) {
                java.util.logging.Logger.getLogger(adminPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IllegalAccessException ex) {
                java.util.logging.Logger.getLogger(adminPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (javax.swing.UnsupportedLookAndFeelException ex) {
                java.util.logging.Logger.getLogger(adminPanel.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
            //</editor-fold>
     
            /* Create and display the form */
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    //new adminPanel().setVisible(true);
                }
            });
        }
     
        // Variables declaration - do not modify                     
        private javax.swing.JButton jButton1;
        private javax.swing.JButton jButton2;
        private javax.swing.JButton jButton3;
        private javax.swing.JButton jButton4;
        private javax.swing.JButton jButton5;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel10;
        private javax.swing.JLabel jLabel11;
        private javax.swing.JLabel jLabel12;
        private javax.swing.JLabel jLabel13;
        private javax.swing.JLabel jLabel14;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel7;
        private javax.swing.JLabel jLabel8;
        private javax.swing.JLabel jLabel9;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JPanel jPanel2;
        private javax.swing.JPanel jPanel3;
        private javax.swing.JPanel jPanel4;
        private javax.swing.JPanel jPanel5;
        private javax.swing.JPanel jPanel6;
        private javax.swing.JPanel jPanel7;
        private javax.swing.JTextField jTextField1;
        private javax.swing.JTextField jTextField2;
        private javax.swing.JTextField jTextField3;
        // End of variables declaration                   
    }

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: unknown error

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    There is a variable with a null value being used in the statement where that exception happened.
    Look at the statement and find what variable has the null value. If you can not see it, add a print statement just before that statement that prints out the values of all the variables used in that statement.
    When you know the variable with the null value, backtrack in the code to see why it does not have a valid value.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. unknown error
    By njabulo ngcobo in forum What's Wrong With My Code?
    Replies: 8
    Last Post: May 29th, 2013, 07:51 AM
  2. java.rmi.unknownhostexception :unknown host: pc error
    By hgauravnayak in forum Exceptions
    Replies: 0
    Last Post: May 22nd, 2013, 03:58 PM
  3. Getting an error! String.charAt(Unknown Source) ???
    By pikapo0 in forum What's Wrong With My Code?
    Replies: 21
    Last Post: March 16th, 2013, 05:54 AM
  4. WHAT IS WRONG??!?!? unknown error
    By ineedhelpasap in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 5th, 2012, 02:07 AM
  5. [SOLVED] Unknown Character
    By aussiemcgr in forum Java Theory & Questions
    Replies: 19
    Last Post: September 1st, 2010, 05:22 PM