I wnat to fill my Table with new Datas which i get by my DataBase(MySQL). I get all datas and create a new Model with them, but if i want to refresh the specific panel, then it wont be repainted.

```
public class PanelWest extends JPanel implements ActionListener {
private JButton but_selectBP;
private JButton but_selectBPAdr;
private JButton but_selectGerichte;
private GroupLayout layoutGroup;
private Connector stmtExecuter = new Connector();
//  private PanelCenter tableViewer = new PanelCenter();

public PanelWest() {
    layoutGroup = createLayout();
    this.setLayout(layoutGroup);
    createButtons();
}

private GroupLayout createLayout() {
    GroupLayout layout = new GroupLayout(this);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    return layout;
}

void createButtons() {
    this.but_selectBP = new JButton("Kunden anzeigen");
    this.but_selectBP.addActionListener(this);
    this.but_selectBPAdr = new JButton("Gerichte anzeigen");
    this.but_selectBPAdr.addActionListener(this);
    this.but_selectGerichte = new JButton("Lieferanten anzeigen");
    this.but_selectGerichte.addActionListener(this);

    this.layoutGroup.setHorizontalGroup(layoutGroup.createParallelGroup().addComponent(but_selectBP).addComponent(but_selectBPAdr).addComponent(but_selectGerichte));
    this.layoutGroup.setVerticalGroup(layoutGroup.createSequentialGroup().addComponent(but_selectBP).addComponent(but_selectBPAdr).addComponent(but_selectGerichte));
}

@Override
public void actionPerformed(ActionEvent e) {
    Object src = e.getSource();

    if (src.equals(this.but_selectBP)) {
        String query = "SELECT * FROM Kunde";
        ResultSet rst = this.stmtExecuter.getResultDBData(query);
    //    this.tableViewer.setTableName("Kunde");
        new PanelCenter().createTable(fillHeader(rst), fillData(rst));
    }

    if (src.equals(this.but_selectBPAdr)) {
        String query = "SELECT * FROM Gericht";
        ResultSet rst = this.stmtExecuter.getResultDBData(query);
    //    this.tableViewer.createTable(fillHeader(rst), fillData(rst));
    }

    if (src.equals(this.but_selectGerichte)) {
        String query = "SELECT * FROM Lieferant";
        ResultSet rst = this.stmtExecuter.getResultDBData(query);
     //   this.tableViewer.createTable(fillHeader(rst), fillData(rst));
    }
}

private String[] fillHeader(ResultSet rst) {
    try {
        ResultSetMetaData rstMetaData = rst.getMetaData();
        String[] header = new String[rstMetaData.getColumnCount()];
        ArrayList<String> headerDetails = new ArrayList<>();
        for (int i = 1; i <= rstMetaData.getColumnCount(); i++) {
           headerDetails.add(rstMetaData.getColumnName(i));
        }
        int j = 0;
        for(String head : headerDetails){
            header[j] = head;
            j++;
        }
        return header;
    } catch (SQLException se) {
        se.printStackTrace();
    }
    return null;
}

private Object[][] fillData(ResultSet rst) {
    try {
        ResultSetMetaData rstMetaData = rst.getMetaData();
        int rowCount = 0;

        rst.last();
        rowCount = rst.getRow();
        System.out.println(rowCount + " Rows");
        rst.beforeFirst();

        Object[][] data = new Object[rowCount][rstMetaData.getColumnCount()];

        int row = 0;
        while (rst.next()) {
            for (int i = 0; i < rstMetaData.getColumnCount(); i++) {
                data[row][i] = rst.getObject(i + 1);
            }
            row++;
        }
        return data;
    } catch (SQLException se) {
        System.out.println("Hier bei Fill");
    }
    return null;
}
}

```

I use remove, add revalidate and repaint on my jpanel. 

```
 void createTable(String[] header, Object[][] data) {
    this.tableData = new JTable();
    this.tableData.setModel(new MyTableModel(header, data));
    this.tableData.setFillsViewportHeight(true);
    this.tableData.addKeyListener(this);
    this.scrollPaneTable = new JScrollPane(tableData);
    this.scrollPaneTable.setSize(500, 500);
    this.remove(this.scrollPaneTable);
    this.add(this.scrollPaneTable);
    this.revalidate();
    this.repaint();
}

```