I'm having a little problem with my Java application. I want to show the orders of a restaurant in my left Jlist, and the details of a selected order in the right Jlist. The orders get read in through a MySQL query and then printed into the Jlist. However, we want to make a refresh button with whitch the query has to be executed again and then printed to the Jlist. However, I can not make the refresh button work. It does refresh the content, but it opens a new Jfram window...

from the GUI Class:

```
public class Barscherm extends javax.swing.JFrame {
private BedieningsManager manager;
/**
 * Creates new form Barscherm
 */
public Barscherm() {
    manager = new BedieningsManager();
    initComponents();
}

    private void opvraagKnopActionPerformed(java.awt.event.ActionEvent evt) {       // This is the refresh button                                     

    jPanel1.removeAll();
    java.awt.EventQueue.invokeLater(new Runnable() {
        public void run() {
            new Barscherm().setVisible(true);
        }
    });
} 

```

From the manager Class:

```
public class BedieningsManager {
private ArrayList<Barbestelling> bestellingen;
private int tafelNummer,bestelNummer, aantal;
Database db1 = new Database();

public BedieningsManager(){
    this.bestellingen = new ArrayList<Barbestelling>();
    maakBestellingen();
   public void maakBestellingen(){
    aantal = db1.getAantalRijenBarBestelling();
    Barbestelling[] bss = new Barbestelling[aantal];
    for (int i = 0; i < aantal; i++){

        tafelNummer = db1.getTafelnummer(i);
        bestelNummer = db1.getBestelNummer(i);
        bss[i] = new Barbestelling(bestelNummer,tafelNummer,"Geplaatst");
        bestellingen.add(bss[i]);

    }

}
public ArrayList<String> toonBarbestellingen()
{
    ArrayList<String> tafelNummers = new ArrayList<String>();

    for(Barbestelling i : bestellingen)
    {
        tafelNummers.add(i.getTafelNummer());
    }

    return tafelNummers;
}

public ArrayList<Barbestelling> getBestellingen()
{
    return bestellingen;
}

public String getDetails(String barbestelling){
    String details = "";
    boolean found = false;
    int count = 0;

    while(!found && count < bestellingen.size())
    {
        if(bestellingen.get(count).getTafelNummer().equals(barbestelling))
        {
            found = true;
            details = bestellingen.get(count).getDetails();
        }
        else
        {
            count ++;
        }
    }
    if(!found)
    {
        System.out.println("Bestelling met Tafelnummer: " + barbestelling + " bestaat niet!");
    }

    return details;
}
}

```

the database query's:

```
public class Database {
private Connection con;
private int bestelNummer;

public Database() {

    String connectiestring;

    connectiestring = "jdbc:mysql://localhost:3306/hartigehap";
    try {   

    con = DriverManager.getConnection(connectiestring,"root", "");  

    } 
    catch(Exception e) {
        System.err.println("Melding: " + e.getMessage());
    }             
}
public int getAantalRijenBestelRegel(int bestelNummer){
      Statement stmt;
      ResultSet rs;
      String query;
      int i = 0;

      try {
          stmt = con.createStatement();
          query = "SELECT COUNT(ItemItemID) FROM bestelregel WHERE barbestellingbestellingnummer = '"+bestelNummer+"'";
          rs = stmt.executeQuery(query);
          while (rs.next()){
            i = rs.getInt("COUNT(ItemItemID)");
          }

      }
      catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
      } 

      return i ;
}
   public int getAantalRijenBarBestelling(){
      Statement stmt;
      ResultSet rs;
      String query;
      int i = 0;

      try {
          stmt = con.createStatement();
          query = "SELECT BestellingNummer FROM barbestelling WHERE Status = 'Geplaatst'";
          rs = stmt.executeQuery(query);

            while ( rs.next() ) {
                i++;
            }
          stmt.close();
      }  
      catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
      } 

      return i ;
}

public String getProduct(int bestelNummer){

  Statement stmt;
  ResultSet rs;
  String query;
  String productNaam = "";

  try {
    stmt = con.createStatement();
    query = "SELECT Naam FROM item, bestelregel WHERE bestelregel.barbestellingbestellingnummer = "+bestelNummer+" AND item.ItemID = bestelregel.ItemItemID";
      rs = stmt.executeQuery(query);

    rs.absolute(bestelNummer);
          productNaam = rs.getString("Naam");  

  }
  catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
  } 
   return productNaam;
}    

public int getTafelnummer(int bestelNummer){

  Statement stmt;
  ResultSet rs;
  String query;
  int tafelNummer = 0;
  bestelNummer++;

  try {
    stmt = con.createStatement();
    query = "SELECT barbestelling.TafelNummer FROM barbestelling WHERE barbestelling.BestellingNummer = "+bestelNummer+"";
      rs = stmt.executeQuery(query);

    rs.absolute(1);
          tafelNummer = rs.getInt("Tafelnummer");  

  }
  catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
  } 
   return tafelNummer;
}    
public int getAantal(int bestelNummer){

  Statement stmt;
  ResultSet rs;
  String query;
  int aantal = 0;

  try {
    stmt = con.createStatement();
    query = "SELECT Aantal FROM bestelregel WHERE barbestellingbestellingnummer = '"+bestelNummer+"'";
      rs = stmt.executeQuery(query);

    rs.absolute(bestelNummer);
          aantal = rs.getInt("Aantal");  

  }
  catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
  } 
   return aantal;
}    
 public String getBestelRegel(int bestelNummer) {

      Statement stmt;
      ResultSet rs;
      String query, querytekst1;
      String details = "";

      try {
          stmt = con.createStatement();
          query = "SELECT bestelregel.Aantal, item.Naam FROM bestelregel, item WHERE bestelregel.barbestellingbestellingnummer = " + bestelNummer + " AND item.ItemID = bestelregel.ItemItemID";
          rs = stmt.executeQuery(query);

          while(rs.next()){

                  String aantal = rs.getString("Aantal");
                  String naam = rs.getString("Naam");
                  details += aantal + " " + naam + "\n";

          }

        }

      catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
      }
      return details;
  }

public int getBestelNummer(int bestelNummer) {

  Statement stmt;
  ResultSet rs;
  String query;
  bestelNummer++;

  try {
    stmt = con.createStatement();
    query = "SELECT BestellingNummer FROM barbestelling WHERE BestellingNummer = '"+bestelNummer+"'  AND Status = 'Geplaatst'";
      rs = stmt.executeQuery(query);

    rs.absolute(1);
          bestelNummer = rs.getInt("BestellingNummer");  

  }
  catch(Exception e) {
      System.err.println("Melding1: " + e.getMessage());
  } 
   return bestelNummer;
}

 private boolean sluitConnectie() {       

  boolean x = false;  
  try {
    if(con != null) {
      con.close();
      x = true;          
    }
  } catch(SQLException e) {
      x = false;
    }        
  return x;
}

}

```

A screenshot of the GUI:

<http://img90.imageshack.us/img90/1676/schoolopdrachtgui.jpg>