This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
You could call the panel.getComponents() method which would return an array of all the components that are part of the panel. But then you need to iterate through them and try to figure out which is the button you need if you need a specific one. Plus it will return any other components added to the panel, such as a label. So you would need to do an "instance of" check on each component as you iterate through to see if it is a button. An then you would need to cast it to a JButton if you need to call a method specific to a Button class.
The easier way would be to retain a reference to each button as you add it. You could store them in a List, or a Map:
So you can get an individual button if needed; or iterate through them all if you need to do something to all of them. [ August 14, 2008: Message edited by: Mark Vedder ]