1

I am having a problem in CardLayout. I have around 15 cards in my swing application. Some cards are there for displaying the data from database, they should run the sql and display the data. The name of a such card is "Lawyers".

But my question is, how do I know that "Lawyer" card is being displayed so I can call the database queries? I am not interested in knowing whether "Lawyer" got displayed after "Account" card or something like that, I just need to know whether it is being displayed now.

Any suggestions?

PeakGen
  • 21,894
  • 86
  • 261
  • 463
  • see my question [JPanel which one of Listeners is proper for visibility is changed](http://stackoverflow.com/questions/10880326/jpanel-which-one-of-listeners-is-proper-for-visibility-is-changed), btw answers are like as effort in your question – mKorbel Sep 03 '14 at 16:36
  • Maybe [duplicate](http://stackoverflow.com/a/25339133/2587435). – Paul Samsotha Sep 03 '14 at 18:24

1 Answers1

2

You could add a ComponentAdapter to your Lawyer card and implement the "componentShown()" method

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80