• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Component Hierarchy

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getComponents() returns an array of Components. This method is inherited from Container.
 
reply
    Bookmark Topic Watch Topic
  • New Topic