Results 1 to 2 of 2

Thread: JTable problem

  1. #1
    robbertds1 is offline Member
    Join Date
    May 2008
    Rep Power

    Default JTable problem

    Hi there,

    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

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Rep Power


    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.

Similar Threads

  1. Sorting JTable (Vectors) Problem
    By ramapple in forum AWT / Swing
    Replies: 6
    Last Post: 07-06-2009, 11:15 PM
  2. Replies: 2
    Last Post: 05-15-2008, 10:15 AM
  3. Replies: 0
    Last Post: 03-29-2008, 04:36 PM
  4. problem in redrawing JTable
    By abhinav in forum AWT / Swing
    Replies: 0
    Last Post: 11-21-2007, 10:08 PM
  5. Problem with JTable
    By Felissa in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 09:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts