Hello Im working with jframe (in java) and I wonder if there is some sort of list for all the jframe Components.
What I mean with Components: jbutton, jtextarea, jcombobox and stuff like that
Hello Im working with jframe (in java) and I wonder if there is some sort of list for all the jframe Components.
What I mean with Components: jbutton, jtextarea, jcombobox and stuff like that
You can use JFrame#getComponents that is inherited from Container
Gets all the components in this container.
Note: This method should be called under AWT tree lock. Returns: an array of all the components in this container. See also: Component.getTreeLock()
Component[] frameCompos = myFrame.getComponents();
// How to print it?
// 1
for (Component c : frameCompos) {
System.out.println(c);
}
// 2
System.out.println(Arrays.toString(frameCompos));