• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to set visible of the JScrollPane and JTable to true when clicking a button

 
Jason Smit
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a strange problem.
In my code where the Button Action Performed is created, I have done the following to ensure that the visibility of the JTable and JScrollPane have been set to true. But it does not work?
Code below:



Any ideas why this is not working???
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you hide/show child components always invoke revaliadate(); and repaint(); on the parent (in that order)
 
Darryl Burke
Bartender
Posts: 5153
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jason Smit wrote:Any ideas why this is not working???


No, and the badly named variables and IDE-generated code don't help, but (1) JDBC and Swing code in the same class and method hint to a poor design and (2) a database query shouldn't normally be executed on the EDT, as it may bog down GUI updates.

Components (other than top-level windows) are visible by default. Did you setVisible(false) somewhere else? Have the scroll pane and table been added to any visible component hierarchy?
 
Jason Smit
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thank you for the replies. Much appreciation.

Yes the paint and validation worked. Thank you!
 
Jason Smit
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:
Jason Smit wrote:Any ideas why this is not working???


No, and the badly named variables and IDE-generated code don't help, but (1) JDBC and Swing code in the same class and method hint to a poor design and (2) a database query shouldn't normally be executed on the EDT, as it may bog down GUI updates.

Components (other than top-level windows) are visible by default. Did you setVisible(false) somewhere else? Have the scroll pane and table been added to any visible component hierarchy?


Hi Mr Bartender or Darryl.

So change my code to suit what you think it would look more appropriate then? Show how the master does it?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!