Esempio n. 1
0
  /** Append a downward triangle image to the right hand side of an input icon. */
  @Override
  public void setIcon(Icon icon) {

    if (isFixedIcon) {
      super.setIcon(icon);
      return;
    }

    if (iconSize == null)
      if (icon != null) iconSize = new Dimension(icon.getIconWidth(), icon.getIconHeight());
      else iconSize = new Dimension(1, 1);

    if (icon == null) {
      // icon = GeoGebraIcon.createEmptyIcon(1, iconSize.height);
    } else {
      icon = GeoGebraIcon.ensureIconSize((ImageIcon) icon, iconSize);
    }

    // add a down_triangle image to the left of the icon
    if (icon != null)
      super.setIcon(
          GeoGebraIcon.joinIcons((ImageIcon) icon, app.getImageIcon("triangle-down.png")));
    else super.setIcon(app.getImageIcon("triangle-down.png"));
  }