Win a copy of Spring Boot in Practice this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JTable Component Event

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am trying to detect when a JTable becomes visible (it is not the same time the JFrame becomes visible).

However, I can't seem to be able to get a Component Event from the JTable.

What do I do?
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a link with a lot of useful stuff on tables.
tables

But I didn't see a way to determine a isvisible event.

How to you setup your table and make it visiable? Perhaps you can make your own event model for it.
 
Ron Patel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Table Model I use comes from a HashMap.

The steps the user takes to make the table visible is by clicking on a node in a JTree. When the user clicks on the node, the JTable is created and displayed in another Panel.

Is there anything I can use there?
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try adding a ComponentListener to the JTable. They have methods for showing, hiding, resizing, and moving components. JTable inherits the addComponentListener from java.awt.Component, which is why you might have missed.
 
Ron Patel
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparently the JTable created Resize events instead of visible events which is why I was missing it.

Thanks all for your help.

=)
 
Stephen Boston
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well this is crude, but take a look at this and see if it helps. BTW; if you removed the table1.setVisible(false) our of the constructor the componentShown() event fires when the table is added.


[ August 17, 2005: Message edited by: Stephen Boston ]
reply
    Bookmark Topic Watch Topic
  • New Topic