Results 1 to 2 of 2
Thread: JTable problem
- 05-20-2008, 05:22 PM #1Member
- Join Date
- May 2008
- Rep Power
In my program I use a JTable thats in a Jpanel to list all my users on it.
There is also a posibility to delete one of those users.
But then the problem starts the JTable stays like it is and I want to refresh it. I know there is a JLissener or something but I dont know how that works.
Is there also another posibility to refresh the panel or Jtable to update my data for the Jtable.
also the option revalidate with a panel seems to doesnt work :s
Can someone please help me
- 05-20-2008, 06:34 PM #2
The JTable listens to the TableModel so it can know when to update itself. Use a DefaultTableModel and make data additons/deletions to it. Depending on the methods you use you may have to use a method in the AbstractTableModel class to announce the change(s). The table will hear about the changes.
Put the JTable in a JScrollPane and eliminate the JPanel. Add the scrollPane to the container that you had added the panel to earlier. JTable implements the Scrollable interface so it knows how to communicate with the parent scrollPane.
- By ramapple in forum AWT / SwingReplies: 6Last Post: 07-06-2009, 11:15 PM
- By salmanpirzada1 in forum Advanced JavaReplies: 2Last Post: 05-15-2008, 10:15 AM
- By rajkenneth in forum NetBeansReplies: 0Last Post: 03-29-2008, 03:36 PM
- By abhinav in forum AWT / SwingReplies: 0Last Post: 11-21-2007, 09:08 PM
- By Felissa in forum AWT / SwingReplies: 2Last Post: 07-04-2007, 09:25 AM