private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
       project=jTextField1.getText();
        component=jTextField2.getText();
        
        String sql= "select * from polishing where project='"+project+"' and component='"+component+"'";
        try{
              Class.forName("com.mysql.jdbc.Driver");
              String uName ="root";
              String uPass ="";
               Connection con =(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/drdo",uName,uPass);
                               
               System.out.println(con.isClosed());
               Statement smt=con.createStatement();
               ResultSet rs=smt.executeQuery(sql);
               rs.next(); 
               //Polisher autofill
               jTextField3.setText(rs.getString(5));
               jTextField4.setText(rs.getString(7));
               jTextField5.setText(rs.getString(8));
               sdate1=rs.getString(8);
               jTextField6.setText(rs.getString(9));
               edate1=rs.getString(9);
               jComboBox4.setSelectedItem(rs.getString(6));
               jLabel29.setText(rs.getString(10));
               time1=rs.getString(10);
               
               //Polishing material(processing)
               material=rs.getString(11);
               if(!"Al₂O₃".equals(material) ||!"CrO₂".equals(material)||!"Diamond paste".equals(material))
               {
                   jComboBox1.setSelectedItem("other");
                   jTextField10.setEnabled(true);
                   jTextField10.setText(material);
               }else
               {
                   jComboBox1.setSelectedItem(material);
                   //jLabel38.setText(material);
               }
               
               testplate_r=rs.getString(12);
               testplate_d=rs.getString(13);
               testplate_vex=rs.getString(14);
               testplate_cave=rs.getString(15);
               if(testplate_r==" " || testplate_d==" "||testplate_vex==" "||testplate_cave==" ")
               {
                   jComboBox2.setEnabled(true);
               }
               else
               {
                   jComboBox2.setEnabled(false);
                   jLabel34.setText(testplate_r);
                   jLabel35.setText(testplate_d);
                   jLabel36.setText(testplate_vex);
                   jLabel37.setText(testplate_cave);
               }
               
              
               //Polishing Iteration autofill
               
               jTextField11.setText(rs.getString(16));
               jComboBox3.setSelectedItem(rs.getString(17));
              
               //Final Inspection autofill
               
               jTextField12.setText(rs.getString(18));
               jTextField15.setText(rs.getString(19));
               jTextField16.setText(rs.getString(20));
               sdate4=rs.getString(20);
               jTextField17.setText(rs.getString(21));
               edate4=rs.getString(21);
               jLabel25.setText(rs.getString(22));
               time4=rs.getString(22);
               total_time=rs.getInt(23);
               
               
                JOptionPane.showMessageDialog(this.getParent(),"Record fetched  successfully,you may perform required operation now");
               con.close();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this.getParent(),"Error fetching record,please enter a valid record");
                  ex.printStackTrace();
            } 
        
        
    }//GEN-LAST:event_jButton1ActionPerformed