This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

To find parent window.  RSS feed

 
Sujatha Rangarajan
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a java swings application with three screens ,say A,B,C.screen c is triggered by buttons on A & B.Is there any way to to distinguish whther screen c is called from A or B?

thanks
 
Darrin Cartwright
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sujatha,

The correct answer to your question depends on how and where you are creating screen C. Here are some possibilities.
You can query the event to get the source object with getSource(). This will give you a reference to the button on A or B. You could also just use different event handlers for the buttons on A and B.
If you want screen C to "know" which called it, you could pass that information to the constructor of C and save it locally.
If you want to post some code, I'm sure we could come up with more specific answers.

Darrin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!