public static JButton findButtonByText(Container container, String text) {
		Component[] comps = container.getComponents();
		for (Component element : comps) {
			if (element instanceof JButton) {
				JButton button = (JButton) element;
				if (button.getText() != null && button.getText().equals(text)) {
					return button;
				}
			}
			else if (element instanceof Container) {
				JButton button = findButtonByText((Container) element, text);
				if (button != null) {
					return button;
				}
			}
		}
		return null;
	}
Searches the subcomponents of the given container and returns the
JButton that has the specified text.

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