i have a Jtable which i use only for display. i.e. no listeners etc. I put it on a JPanel.
i have another class which extends JFrame and i put all the buttons there. there is also the table with the loaded values from file.
the problem is that when i change the values i have to restart the program for the values to be seen,
any help on refreshing the panel when the user clicks on refresh?
Rob Camick
Ranch Hand
Joined: Jun 13, 2009
Posts: 1786
2
posted
0
Without seeing your code its hard to guess what you are doing, but I will guess that your problem is that you are creating a new JTable when you are attempting to refresh the data. This is the wrong approach. The solution is to create a new TableModel and add it to the existing table. Something like:
you have a file
your program reads this file and displays the data in a JTable you change the contents of the file, but not via your program.
you want the changes reflected in the JTable