Java JToolBar hideChildButtonsWithTooltip(Container parent, String tooltip)

Here you can find the source of hideChildButtonsWithTooltip(Container parent, String tooltip)

Description

Find button by tooltip

License

Open Source License

Parameter

Parameter Description
parent a parameter
tooltip a parameter

Declaration

private static void hideChildButtonsWithTooltip(Container parent, String tooltip) 

Method Source Code


//package com.java2s;
//License from project: GNU General Public License 

import java.awt.Component;
import java.awt.Container;
import javax.swing.AbstractButton;

public class Main {
    /**/*from   w  ww  . j  a  v a  2  s  .c o  m*/
     * Find button by tooltip
     * 
     * @param parent
     * @param tooltip
     */
    private static void hideChildButtonsWithTooltip(Container parent, String tooltip) {

        for (Component component : parent.getComponents()) {
            if (component instanceof AbstractButton
                    && tooltip.equals(((AbstractButton) component).getToolTipText())) {
                component.setVisible(false); // hide this
            } else if (component instanceof Container) {
                hideChildButtonsWithTooltip((Container) component, tooltip);
            }
        }

    }
}

Related

  1. floatToolBar(JToolBar tb, Point p)
  2. formatToolBar(JToolBar toolbar, int style)
  3. getToolbarButton(JToolBar toolbar, Action action)
  4. getToolBarFill(int orientation)
  5. getToolbarOrientation(String location)
  6. initIconButton(AbstractButton button, String toolTip)
  7. isToolBarButton(JComponent c)
  8. isToolBarButton(JComponent c)
  9. makeToolButton(URL iconURL, String cmd, String tooltip, String alt, ActionListener listener)