This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Problems with GUI

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm facing this problem with my Gui, please advise if anyone else has come across same issue. The first time I access my app, I select an origin and destination and correctly populate my JTable. I then perform another search and I see correct data in the JTable, but when I select a row, the table data changes back to the first request data. My Gui class implements just ActionListener and I am extending AbstractTableModel. Am I missing something here?
 
Ranch Hand
Posts: 2937
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a method equivalent to the one shown below in your table data model, and do you invoke it after you get new search results?

Eugene.
 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
There is no need keep any reference after the second search where the old searched information can exists.
Are u creating multiple instances of your TableModel ?? and by mistake using the older instance of the tableModel to populate the Table..
I think that one of the best practice to populate the table is to create one instance of the table model.. set this model to the Flight table..
Also, Create a public method in your extended table model to update/change the data in the modal. As mentioned by Eugene.
 
Pervez Ahmed
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Eugene I do just that. Are you using a "Model Manager" class?
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi pervej,
i think you are adding the Jpanel into the contentPane of your JFrame,make sure you remove the old search reference of your Jpanel from the contentpane,before you add new search reference of JPanel to the contentpane of this JFrame.
hope this helps
harcharan
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic