[Solved] AWT-EventQueue-0 Exception when openning JFrame


All the code used to initialize the table model shouldn’t be part of its constructor. Don’t create a class extending DefaultTableModel, and don’t use static variables for the data and columns: you don’t want all the instances of your model to share a unique data vecstor and a unique columns vector.

Move all this code to a simple method which, once the data and columns names are ready, creates the model:

private TableModel createTableModel() {
    Vector data = new Vector();
    Vector columns = new Vector();

    // populate data and columns using JDBC. Use only local variables

   return new DefaultTableModel(data, columns);
}

6

solved AWT-EventQueue-0 Exception when openning JFrame