Java JToolBar setToolIcons(AbstractButton b, Icon[] icons)

Here you can find the source of setToolIcons(AbstractButton b, Icon[] icons)

Description

Change the Icons of an AbstractButton (JButton or JToggleButton).

License

Open Source License

Parameter

Parameter Description
b the button whose icons are to be set
icons four <code>Icon</code> objects for different gadget states, such as created by the <code>createToolIcons</code> method.

Declaration

public static void setToolIcons(AbstractButton b, Icon[] icons) 

Method Source Code

//package com.java2s;
/*//from  w  w w .j  a v  a 2  s. c  o  m
 *  GraphicsUtil.java
 *  Eisenkraut
 *
 *  Copyright (c) 2004-2015 Hanns Holger Rutz. All rights reserved.
 *
 *  This software is published under the GNU General Public License v3+
 *
 *
 *   For further information, please contact Hanns Holger Rutz at
 *   contact@sciss.de
 */

import javax.swing.AbstractButton;
import javax.swing.Icon;

public class Main {
    /**
     *  Change the <code>Icon</code>s of an
     *  <code>AbstractButton</code> (<code>JButton</code>
     *  or <code>JToggleButton</code>).
     *
     *  @param  b      the button whose icons are to be set
     *  @param  icons   four <code>Icon</code> objects for
     *               different gadget states, such as
     *               created by the <code>createToolIcons</code> method.
     *
     *  @see   #createToolIcons( int )
     */
    public static void setToolIcons(AbstractButton b, Icon[] icons) {
        b.setIcon(icons[0]);
        b.setSelectedIcon(icons[1]);
        b.setPressedIcon(icons[3]);
        b.setDisabledIcon(icons[2]);
        //        Insets defInsets = b.getInsets();
    }
}

Related

  1. isToolBarButton(JComponent c)
  2. isToolBarButton(JComponent c)
  3. makeToolButton(URL iconURL, String cmd, String tooltip, String alt, ActionListener listener)
  4. resizeToolBarButtons(JComponent toolbar)
  5. searchFakeToolBarRecursive(Container c)
  6. setToolIcons(AbstractButton b, Icon[] icons)
  7. showTextOnToolbar(javax.swing.JToolBar t, boolean show)
  8. styleToolBarButton(final AbstractButton btn, final Font font, final boolean addPadding)