Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Component Hierarchy  RSS feed

 
Satheesh Thekku Veethil
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I am trying to come up with a little tool to tag components on a user interface. Here's the strategy I am following:
I take a component and traverse into it and find out the components in it and obtain its name. Thereby associating a tag to the component.
Now I have a little problem in achieving this. I cannot find out if the particular component contains any further components or does it exist by itself.
Let me take an example. Assume a user interface to contain two panels on the root panel. each panel has two buttons and a label. Now at the top level i will have to assume that its a panel and then go into it. In fact if someone just puts a button on the root panel then this strategy would fail.
Does java provide any APIs to access the tree structure of the user interface components. Presently I am aware of getComponentCount which provides the number of components on any container.
Please suggest some hooks if available.
Regards
Sat
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getComponents() returns an array of Components. This method is inherited from Container.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!