Java AbstractTableModel repaint();
-
23-02-2021 - |
Question
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 ?
Solution
You should really post the code or better an SSCCE.
Here's the Oracle's tutorial on JTable.
I'll give you some hints:
- Each JTable has a TableModel associated
- You don't display the TableModel but the JTable, that is a view of your model
- When you add components dynamically you should revalidate the parent component, so if you are adding a JTable somewhere, try to revalidate its container.
- 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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow