public static JButton findButtonByActionName(Container container, String name) {
		Component[] comps = container.getComponents();
		for (Component element : comps) {
			if (element instanceof JButton) {

				JButton button = (JButton) element;
				if (button instanceof DialogToolbarButton) {
					DockingActionIf dockingAction =
						((DialogToolbarButton) button).getDockingAction();
					if (dockingAction.getName().equals(name)) {
						return button;
					}
				}
				Action action = button.getAction();
				if (action != null) {
					Object nameObject = action.getValue("name");
					if (nameObject != null && nameObject.toString().equals(name)) {
						return button;
					}
				}
			}
			else if (element instanceof Container) {
				JButton button = findButtonByActionName((Container) element, name);
				if (button != null) {
					return button;
				}
			}
		}
		return null;
	}
Searches the component and subcomponents of the indicated provider and returns the
component with the specified name.

@param provider the provider of the component to search
@param name the name of the desired component

@return the component, or null if not found
Ghidra/Framework/Docking/src/main/java/docking/test/AbstractDockingTest.java