title: how to run multiple function in one button using java
body: <p>I already search many time for this but I can't find the code that will work properly. I also try recommended by questions by stackoverflow but still not successful.</p>
  
  <p>I created a search function in my program in java and it's working fine during my testing one by one, but when I called all the search function in 1 button the only working is the last part only not all function,</p>
  
  <p>here is my sample code of running all the function.</p>
  
  <pre><code>     public ArrayList&lt;pcfdBoards&gt; ListofInventory(String ValToSearch)
  {
      ArrayList&lt;pcfdBoards&gt; usersList = new ArrayList&lt;pcfdBoards&gt;();
  
      Statement st;
      ResultSet rs;
  
      try{
          Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
          String url = "jdbc:sqlserver://ets88-spare:1433;databaseName=users;user=sa;password=test";
          Connection conn = DriverManager.getConnection(url);
          st = conn.createStatement();
          String searchQuery = "SELECT * FROM PCFD WHERE CONCAT(sno,BoardName) LIKE '%"+ValToSearch+"%'";
          rs = st.executeQuery(searchQuery);
          pcfdBoards user;
          while(rs.next())
          {
              user = new pcfdBoards( rs.getInt("sno"), 
                                          rs.getString("Date"), 
                                          rs.getString("DieType"), 
                                          rs.getString("DeviceName"), 
                                          rs.getString("ProgramName"), 
                                          rs.getString("ProgramRevision"), 
                                          rs.getString("BoardName"), 
                                          rs.getString("SerialNumber"),
                                          rs.getString("BoardRevision"),
                                          rs.getString("BoardSlotNumber"),
                                          rs.getString("DIBChannel"),
                                          rs.getString("Area"),
                                          rs.getString("TestOption"),
                                          rs.getString("TestName"),
                                          rs.getString("BinNumber"),
                                          rs.getString("LoadboardSN"),
                                          rs.getString("MotherboardSN"),
                                          rs.getString("AdditionalHW"),
                                          rs.getString("VerifiedBy"),
                                          rs.getString("Datalogs"));
              usersList.add(user);
          }            
      }catch(ClassNotFoundException | SQLException ex){
          jnote.setBackground(Color.red);
          jnote.setText(ex.toString());
      }
  
      return usersList;
              }
  
        public void boardname() {ArrayList&lt;pcfdBoards&gt; users = ListofInventory(jboardnameSearch.getText());
      DefaultTableModel model = new DefaultTableModel();
      model.setColumnIdentifiers(new Object[]{"Item ID","Date","Die Type","Device Name", "Program Name", "Program Revision", "Board Name","Serial Number","Board Revision","Board Slot Number","DIB Channel","Area","Test Option","Test Name","Bin Number","Loadboard SN","Motherboard SN","Additional HW","Verifief By","Datalogs"});
      Object[] row = new Object[21];
      for(int i = 0; i &lt; users.size(); i++)
      {
          row[0] = users.get(i).getsno();
          row[1] = users.get(i).getDate();
          row[2] = users.get(i).getDieType();
          row[3] = users.get(i).getDeviceName();
          row[4] = users.get(i).getProgramName();
          row[5] = users.get(i).getProgramRevision();
          row[6] = users.get(i).getBoardName();
          row[7] = users.get(i).getSerialNumber();
          row[8] = users.get(i).getBoardRevision();
          row[9] = users.get(i).getBoardSlotNumber();
          row[10] = users.get(i).getDIBChannel();
          row[11] = users.get(i).getArea();
          row[12] = users.get(i).getTestOption();
          row[13] = users.get(i).getTestName();
          row[14] = users.get(i).getBinNumber();
          row[15] = users.get(i).getLoadboardSN();
          row[16] = users.get(i).getMotherboardSN();
          row[17] = users.get(i).getAdditionalHW();
          row[18] = users.get(i).getVerifiedBy();
          row[19] = users.get(i).getDatalogs();
          model.addRow(row);
      }
     jTable1.setModel(model);
             }
      public ArrayList&lt;pcfdBoards&gt; ListofInventorySN(String ValToSearch)
  {
      ArrayList&lt;pcfdBoards&gt; usersList = new ArrayList&lt;pcfdBoards&gt;();
  
      Statement st;
      ResultSet rs;
  
      try{
          Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
          String url = "jdbc:sqlserver://ets88-spare:1433;databaseName=users;user=sa;password=test";
          Connection conn = DriverManager.getConnection(url);
          st = conn.createStatement();
          String searchQuery = "SELECT * FROM PCFD WHERE CONCAT(sno,SerialNumber) LIKE '%"+ValToSearch+"%'";
          rs = st.executeQuery(searchQuery);
          pcfdBoards user;
          while(rs.next())
          {
              user = new pcfdBoards( rs.getInt("sno"), 
                                          rs.getString("Date"), 
                                          rs.getString("DieType"), 
                                          rs.getString("DeviceName"), 
                                          rs.getString("ProgramName"), 
                                          rs.getString("ProgramRevision"), 
                                          rs.getString("BoardName"), 
                                          rs.getString("SerialNumber"),
                                          rs.getString("BoardRevision"),
                                          rs.getString("BoardSlotNumber"),
                                          rs.getString("DIBChannel"),
                                          rs.getString("Area"),
                                          rs.getString("TestOption"),
                                          rs.getString("TestName"),
                                          rs.getString("BinNumber"),
                                          rs.getString("LoadboardSN"),
                                          rs.getString("MotherboardSN"),
                                          rs.getString("AdditionalHW"),
                                          rs.getString("VerifiedBy"),
                                          rs.getString("Datalogs"));
              usersList.add(user);
          }            
      }catch(ClassNotFoundException | SQLException ex){
          jnote.setBackground(Color.red);
          jnote.setText(ex.toString());
      }
  
      return usersList;
          }       
     public void serialNum() {ArrayList&lt;pcfdBoards&gt; users = ListofInventorySN(jSerialNumSearch.getText());
      DefaultTableModel model = new DefaultTableModel();
      model.setColumnIdentifiers(new Object[]{"Item ID","Date","Die Type","Device Name", "Program Name", "Program Revision", "Board Name","Serial Number","Board Revision","Board Slot Number","DIB Channel","Area","Test Option","Test Name","Bin Number","Loadboard SN","Motherboard SN","Additional HW","Verifief By","Datalogs"});
      Object[] row = new Object[21];
      for(int i = 0; i &lt; users.size(); i++)
      {
          row[0] = users.get(i).getsno();
          row[1] = users.get(i).getDate();
          row[2] = users.get(i).getDieType();
          row[3] = users.get(i).getDeviceName();
          row[4] = users.get(i).getProgramName();
          row[5] = users.get(i).getProgramRevision();
          row[6] = users.get(i).getBoardName();
          row[7] = users.get(i).getSerialNumber();
          row[8] = users.get(i).getBoardRevision();
          row[9] = users.get(i).getBoardSlotNumber();
          row[10] = users.get(i).getDIBChannel();
          row[11] = users.get(i).getArea();
          row[12] = users.get(i).getTestOption();
          row[13] = users.get(i).getTestName();
          row[14] = users.get(i).getBinNumber();
          row[15] = users.get(i).getLoadboardSN();
          row[16] = users.get(i).getMotherboardSN();
          row[17] = users.get(i).getAdditionalHW();
          row[18] = users.get(i).getVerifiedBy();
          row[19] = users.get(i).getDatalogs();
          model.addRow(row);
      }
     jTable1.setModel(model);
             }
  </code></pre>
  
  <p>How can I call the boardname() and serialNum() using one button only,
  I try to use below code but the last part is always working, not all.</p>
  
  <pre><code>    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
              boardname();
              serialNum();
           }        
  </code></pre>