File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use getParent() ?

 
chen young
Ranch Hand
Posts: 197
  • 0
  • 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
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you please add example ?
 
Maneesh Godbole
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • 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
  • 0
  • 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
Saloon Keeper
Posts: 10971
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • 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
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • 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
  • 0
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic