Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is my conceptual error?  RSS feed

 
Ron Aronica
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am setting up a simple Swing application that has the following steps:
1. Start up with menu and empty content pane,
2. User clicks on menu item that displays FileChooser and user selects a file, and
3. Application displays a JTable that contains the data in the file on a pannel (using a Layout Manager) on the content pane.
To get it to display properly (thanks to Nathan Pruett), I must call notify() before calling repaint().
Am I approaching the design of this application correctly? I have not seen any reference to the need to call notify() in any Swing documentation or tutoral. Since no one seems to develop Swing applications this way, I am coming to believe that my design is incorrect. Should I design the application using a different model: placeing JTable on the content pane at startup but setting visibility to 'false'; placeing JTable in a MDI frame; etc.?
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm... maybe keep the JTable on the screen and change the data in the table model... that seems to make the most sense here.
 
Bill White
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using alot of JTables on my current project and agree with Nathan. That is the approach I am using.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!