aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how do I know what components are in a jpanel? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how do I know what components are in a jpanel?" Watch "how do I know what components are in a jpanel?" New topic
Author

how do I know what components are in a jpanel?

Kay Tracid
Ranch Hand

Joined: Mar 06, 2002
Posts: 148
Hi,
I have a JPanel with some components. How can I check if a JButton belongs to this JPanel?

Thanks!
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Hello,
In the AWT we have Container.getComponents() which returns an array of Components in the Container.
Note: javax.swing.JPanel is a subclass of java.awt.Container.
Good Luck,
-Dirk Schreckmann


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do I know what components are in a jpanel?