public static AbstractButton findAbstractButtonByText(Container container, String text) {

		Component[] comp = container.getComponents();
		for (Component element : comp) {
			if ((element instanceof AbstractButton) &&
				text.equals(((AbstractButton) element).getText())) {
				return (AbstractButton) element;
			}
			else if (element instanceof Container) {
				AbstractButton b = findAbstractButtonByText((Container) element, text);
				if (b != null) {
					return b;
				}
			}
		}
		return null;
	}
Searches the sub-components of the given container and returns the
AbstractButton that has the specified text.
<p>
This differs from {@link #findButtonByText(Container, String)} in that
this method will find buttons that do not extend from {@link JButton}.
That method is convenient when you do not wish to cast the result from
AbstractButton to JButton. Other than that, this method can handle all
cases the other method cannot.

@param container container to search
@param text button text
@return null if the button was not found
Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java