This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to use getParent() ?  RSS feed

 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created a class that extend JDialog , and initialize the constructer with jframe as the parent window.





How can I use getParent() in order to get all components from the jframe parent ?


Thanks
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container has some methods to query the components it has.
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please add example ?
 
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
Did you check out the Container API like Rob suggested?
Did you find any methods how to get components (wink, broad hint) for a given container?
 
chen young
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes ,
I did check and I don't understand how should I retrieve the parent frame.

Thanks anyway
 
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
angus young wrote:
I did check and I don't understand how should I retrieve the parent frame.


Looks like there is some confusion here. What exactly are you trying to do, because you initially said
How can I use getParent() in order to get all components from the jframe parent ?


So do you want to retrieve the parent or the components nested in a parent?
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To retrieve the parent, call getParent() until you find the one you need:
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> How can I use getParent() in order to get all components from the jframe parent ?

why would you want to? - you pass the parent as an argument to the dialog's constructor, so use that.


now the rest of the FindMenu() code can refer to parentFrame
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!