aajjbb
aajjbb

Reputation: 91

Java AbstractTableModel repaint();

I have a problem in my table model to update the data I print in it.

I have the class AgendaTableModel who is the table model, and the class Screen that is the main UI, when I press the button 'Listar Contatos' the table model should appear on JScrollPane in the center of the JFrame, but it continues blank.

What should be the problem ?

Upvotes: 0

Views: 696

Answers (1)

Heisenbug
Heisenbug

Reputation: 39174

You should really post the code or better an SSCCE.

Here's the Oracle's tutorial on JTable.

I'll give you some hints:

  1. Each JTable has a TableModel associated
  2. You don't display the TableModel but the JTable, that is a view of your model
  3. When you add components dynamically you should revalidate the parent component, so if you are adding a JTable somewhere, try to revalidate its container.
  4. If you are trying to add the JTable to an already existing JScrollPane (empty or containing something else), consider to instantiate a new JScrollPane rather than updating its content.

Upvotes: 1

Related Questions