ui/src/main/java/ucar/nc2/ui/widget/BAMutil.java
public static AbstractButton makeButtcon( Icon icon, Icon selected, String tooltip, boolean is_toggle) {
    AbstractButton butt;
    if (is_toggle)
      butt = new JToggleButton();
    else
      butt = new JButton();

    if (debug) System.out.println("   makeButtcon"+ icon+ " "+ selected+ " "+ tooltip+ " "+ is_toggle);

    if (icon != null)
      butt.setIcon(icon);

    if (selected != null) {
      if (is_toggle) {
        butt.setSelectedIcon( selected);
      } else {
        butt.setRolloverIcon(selected);
        butt.setRolloverSelectedIcon(selected);
        butt.setPressedIcon(selected);
        butt.setRolloverEnabled(true);
      }
    }

    butt.setMaximumSize(new Dimension(28,28));       // kludge
    butt.setPreferredSize(new Dimension(28,28));
    butt.setToolTipText(tooltip);
    butt.setFocusPainted(false);

    return butt;
  }
public static AbstractButton makeButtcon( Icon icon, Icon selected, String tooltip, boolean is_toggle) {
    AbstractButton butt;
    if (is_toggle)
      butt = new JToggleButton();
    else
      butt = new JButton();

    if (debug) System.out.println("   makeButtcon"+ icon+ " "+ selected+ " "+ tooltip+ " "+ is_toggle);

    if (icon != null)
      butt.setIcon(icon);

    if (selected != null) {
      if (is_toggle) {
        butt.setSelectedIcon( selected);
      } else {
        butt.setRolloverIcon(selected);
        butt.setRolloverSelectedIcon(selected);
        butt.setPressedIcon(selected);
        butt.setRolloverEnabled(true);
      }
    }

    butt.setMaximumSize(new Dimension(28,28));       // kludge
    butt.setPreferredSize(new Dimension(28,28));
    butt.setToolTipText(tooltip);
    butt.setFocusPainted(false);

    return butt;
  }
public static AbstractButton makeButtcon ( Icon icon , Icon selected , String tooltip , boolean is_toggle ) { AbstractButton butt ; if ( is_toggle ) butt = new JToggleButton ( ) ; else butt = new JButton ( ) ; if ( debug ) System . out . println ( "   makeButtcon" + icon + " " + selected + " " + tooltip + " " + is_toggle ) ; if ( icon != null ) butt . setIcon ( icon ) ; if ( selected != null ) { if ( is_toggle ) { butt . setSelectedIcon ( selected ) ; } else { butt . setRolloverIcon ( selected ) ; butt . setRolloverSelectedIcon ( selected ) ; butt . setPressedIcon ( selected ) ; butt . setRolloverEnabled ( true ) ; } } butt . setMaximumSize ( new Dimension ( 28 , 28 ) ) ; // kludge butt . setPreferredSize ( new Dimension ( 28 , 28 ) ) ; butt . setToolTipText ( tooltip ) ; butt . setFocusPainted ( false ) ; return butt ; }
Make a "buttcon" = button with an Icon
@param icon the normal Icon
@param selected the selected Icon
@param tooltip the tooltip
@param is_toggle if true, make JToggleButton, else JButton
@return the buttcon (JButton or JToggleButton)
Make a buttcon = button with an Icon