Package javax.swing

Examples of javax.swing.Icon


        colCount = 2;
      }
      int iconHeight = 0;
      int currentX = x;
      for (int i = 0; i < mIconArr.length; i++) {
        Icon icon = mIconArr[i];
        boolean nextColumn = (colCount == 1) || (i % 2 == 0);
        if (nextColumn) {
          currentX = x;
          iconHeight = icon.getIconHeight();
        }
        else {
          iconHeight = Math.max(iconHeight, icon.getIconHeight());
        }
        if ((y + iconHeight) < mHeight) {
          icon.paintIcon(this, grp, currentX, y);
        }
        if (nextColumn) {
          currentX += icon.getIconWidth() + ICON_DISTANCE_X;
        }
        if (!nextColumn || (colCount == 1)) {
          y += iconHeight + ICON_DISTANCE_Y;
        }
      }
View Full Code Here


   *
   * @param collapseIcon
   *          collapse icon for this disclosure triangle container
   */
  public void setCollapseIcon(final Icon collapseIcon) {
    Icon oldCollapseIcon = this.collapseIcon;
    this.collapseIcon = collapseIcon;
    firePropertyChange("collapseIcon", oldCollapseIcon, this.collapseIcon);
    if (!collapsed) {
      label.setIcon(this.collapseIcon);
    }
View Full Code Here

   *
   * @param expandIcon
   *          expand icon for this disclosure triangle container
   */
  public void setExpandIcon(final Icon expandIcon) {
    Icon oldExpandIcon = this.expandIcon;
    this.expandIcon = expandIcon;
    firePropertyChange("expandIcon", oldExpandIcon, this.expandIcon);
    if (collapsed) {
      label.setIcon(this.expandIcon);
    }
View Full Code Here

    for (PluginProxy plugin : PluginProxyManager.getInstance().getActivatedPlugins()) {
      final String iconText = plugin.getProgramTableIconText();
      if (iconText != null) {
        Icon[] icons = plugin.getProgramTableIcons(PluginManagerImpl.getInstance().getExampleProgram());
        Icon icon;
        if (icons != null && icons.length > 0) {
          icon = icons[0];
        }
        else {
          icon = null;
View Full Code Here

      }
    }

    // Found closest match, resize it
    if (closestMatch != null) {
      Icon closestIcon = getImageFromTheme(closestMatch);
      return (ImageIcon) UiUtilities.scaleIcon(closestIcon, icon.getSize(), icon.getSize());
    }
   
    return null;
  }
View Full Code Here

          ProgramReceiveTarget[] targets = plugin.getProgramReceiveTargets();
          if (!plugin.canReceiveProgramsWithTarget()) {
            JMenuItem item = new JMenuItem(plugin.getInfo().getName());
            item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            item.setIcon(icon != null ? icon : null);
            menu.add(item);
            item.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Program[] programs = collectProgramsFromNode(node);
                if ((programs != null) && (programs.length > 0)) {
                  plugin.receivePrograms(programs, ProgramReceiveTarget.createDefaultTargetForProgramReceiveIfId(plugin.getId()));
                }
              }
            });
          } else if (targets.length == 1 && (!(o instanceof ProgramReceiveTarget) || !o.equals(targets[0]))) {
            JMenuItem item = new JMenuItem(targets[0].toString());
            item.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            item.setIcon(icon != null ? icon : null);
            menu.add(item);

            final ProgramReceiveTarget target = targets[0];

            item.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                Program[] programs = collectProgramsFromNode(node);
                if ((programs != null) && (programs.length > 0)) {
                  plugin.receivePrograms(programs, target);
                }
              }
            });
          } else if (targets.length >= 1) {
            JMenu subMenu = new JMenu(plugin.getInfo().getName());
            subMenu.setFont(MenuUtil.CONTEXT_MENU_PLAINFONT);

            Icon icon = plugin.getPluginIcon();

            subMenu.setIcon(icon != null ? icon : null);
            menu.add(subMenu);

            for (final ProgramReceiveTarget target : targets) {
View Full Code Here

  {
    final JButton button = new ActionButton(action);
    boolean needText = true;
    if (isLargeButtonsEnabled(swingGuiContext))
    {
      final Icon icon = (Icon) action.getValue(SwingCommonModule.LARGE_ICON_PROPERTY);
      if (icon != null && (icon.getIconHeight() > 1 && icon.getIconHeight() > 1))
      {
        button.setIcon(icon);
        needText = false;
      }
    }
    else
    {
      final Icon icon = (Icon) action.getValue(Action.SMALL_ICON);
      if (icon != null && (icon.getIconHeight() > 1 && icon.getIconHeight() > 1))
      {
        button.setIcon(icon);
        needText = false;
      }
    }
View Full Code Here

    }
  }

  private JPanel createOrientationPanel()
  {
    final Icon portraitIcon = guiContext.getIconTheme().getLargeIcon(getLocale(), "pagesetup.portrait");
    final JLabel portraitLabel = new JLabel(messages.getString("PageSetupDialog.Portrait"), portraitIcon, SwingConstants.LEFT);
    portraitLabel.setLabelFor(portraitModeBox);

    final Icon landscapeIcon = guiContext.getIconTheme().getLargeIcon(getLocale(), "pagesetup.landscape");
    final JLabel landscapeLabel = new JLabel(messages.getString("PageSetupDialog.Landscape"), landscapeIcon, SwingConstants.LEFT);
    landscapeLabel.setLabelFor(landscapeModeBox);

    final JPanel contentPane = new JPanel();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));
View Full Code Here

  {
    if (iconTheme != null)
    {
      if (StatusType.ERROR.equals(type))
      {
        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.errorIcon"); //$NON-NLS-1$
        statusHolder.setIcon(res);
      }
      else if (StatusType.WARNING.equals(type))
      {
        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.warningIcon"); //$NON-NLS-1$
        statusHolder.setIcon(res);
      }
      else if (StatusType.INFORMATION.equals(type))
      {
        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.informationIcon"); //$NON-NLS-1$
        statusHolder.setIcon(res);
      }
      else
      {
        final Icon res = getIconTheme().getSmallIcon(getLocale(), "statusbar.otherIcon"); //$NON-NLS-1$
        statusHolder.setIcon(res);
      }
    }
  }
View Full Code Here

   */
  protected Icon getEmptyIcon()
  {
    if (emptyIcon == null)
    {
      final Icon errorIcon = getErrorIcon();
      final int width = errorIcon.getIconWidth();
      final int height = errorIcon.getIconHeight();

      final BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
      emptyIcon = new ImageIcon(bi);
    }
    return emptyIcon;
View Full Code Here

TOP

Related Classes of javax.swing.Icon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.