This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I seem to have an anoying problem. The problem is that when i try to insert data in to a JTable using a JButton the JTable wont update until i resize the frame manually, sometimes this does not work. Though the same code works perfectly on some computers, dont know if it is the JDK version or not. Anyways heres the code:
in your actionListener you create a new JTable, but don't do anything with it.
the fact it works on some computers indicates that in your real code you probably remove the old table from the scrollpane, then add the new one. in this case it should be scrollPane.revalidate(); repaint();//sometimes required, sometimes not, safest to have it
you don't really need to create a new JTable, then remove/add, just change the tableModel
(table will need to be made final, or moved so it is a class field - not local)