Getting a component

Given a component name, that was previously added to a frame, is there a method available for getting the component's object ?
[134 byte] By [Gen.Javaa] at [2007-10-3 8:29:27]
# 1
You may use getParent() to search upward, and getComponents() to search downward. For example, searching upward:SwingUtilities.getAncestorNamed(String name, Component comp)
jvaudrya at 2007-7-15 3:36:19 > top of Java-index,Desktop,Core GUI APIs...
# 2

jvaudry,

Thank you.

"SwingUtilities.getAncestorNamed(String name, Component comp)" relies on having a child to search above which I don't have. I only have a name for the component I need to fetch.

Also, I had previously wrote a method to search each frame in the hierarchy using getComponents(), but I was just curious if there is an already available method for this. Something like:

Component c = SwingUtilities.getObject(String name);

Gen.Javaa at 2007-7-15 3:36:19 > top of Java-index,Desktop,Core GUI APIs...
# 3
Why isn't there a method like the following to get a component object given a component name:Component c = container.getComponent(String name);While there is the method:Component c = container.getComponent(int n);
Gen.Javaa at 2007-7-15 3:36:19 > top of Java-index,Desktop,Core GUI APIs...