This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable doesn't refresh :(  RSS feed

 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I'm doing a project for the university and I've got a problem with a JTable.
When I add some items it doesn't get updated, if someone could help I'd appreciate it.

Here is my code :



As you can understand... my attempt at the method reloadTheGUI() doesn't work. I'm planning on implementing there the code to refresh the JTable.
 
Tomer Gal
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anybody ?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

First, a bit of business: you may not have read our naming policy on your way in. It requires that you use a full, real (sounding) first and last name for your display name. An initial isn't enough for a last name. You can change your display name here. Thanks!

Now, as to your problem: the TableModel needs to let the rest of the world know the data has changed. The way to do that is via a TableModelEvent, and the easiest thing you could do would be to call fireTableDataChanged() on your TableModel. This will cause the JTable to refetch all of its contents from the model.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!