This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do I know what components are in a jpanel?

 
Kay Tracid
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JPanel with some components. How can I check if a JButton belongs to this JPanel?

Thanks!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic