Package javax.swing

Examples of javax.swing.Icon


  }

  private void addButtonProperties(final AbstractButton button,
      final Action action) {
    String tooltip = (String) action.getValue(Action.SHORT_DESCRIPTION);
    Icon icon = getIcon(action);
    String title = getTitle(action);

    button.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(new ActionEvent(action,ActionEvent.ACTION_PERFORMED,""));
View Full Code Here


    return null;
  }

  private Icon getIcon(Action action) {
    if ((mStyle & STYLE_ICON) == STYLE_ICON) {
      Icon icon;
      if (mIconSize == ICON_BIG) {
        icon = (Icon) action.getValue(Plugin.BIG_ICON);
        if (icon == null) {
          mLog.warning("Big icon missing for action " + action.getValue(Action.NAME));
          icon = (Icon) action.getValue(Action.SMALL_ICON);
        }
        if ((icon != null)
            && ((icon.getIconHeight() != TVBrowserIcons.SIZE_LARGE) || (icon.getIconWidth() != TVBrowserIcons.SIZE_LARGE))) {
          icon = UiUtilities.scaleIcon(icon, TVBrowserIcons.SIZE_LARGE, TVBrowserIcons.SIZE_LARGE);
        }

      } else {
        icon = (Icon) action.getValue(Action.SMALL_ICON);

        if ((icon != null)
            && ((icon.getIconHeight() != 16) || (icon.getIconWidth() != 16))) {
          icon = UiUtilities.scaleIcon(icon, 16, 16);
        }

      }
      return icon;
View Full Code Here

        ContextMenuIf menuIf = (ContextMenuIf) value;
        Program exampleProgram = Plugin.getPluginManager().getExampleProgram();

        // Get the context menu item text
        StringBuilder text = new StringBuilder();
        Icon icon = null;
        ActionMenu actionMenu = menuIf.getContextMenuActions(exampleProgram);
        if (actionMenu != null) {
          Action action = actionMenu.getAction();
          if (action != null) {
            text.append((String) action.getValue(Action.NAME));
View Full Code Here

    updateChannelItems();
    updateTimeItems();

    mLicenseMenu = createLicenseMenuItems();

    Icon urlHelpImg = IconLoader.getInstance().getIconFromTheme("apps",
        "help-browser", 16);
    Icon urlBrowserImg = IconLoader.getInstance().getIconFromTheme("apps",
        "internet-web-browser", 16);

    mInstallPluginsMI = createMenuItem("menuitem.installPlugins",
        "Install/Update Plugins", urlBrowserImg, true);
    mInstallPluginsMI.addActionListener(this);
View Full Code Here

    });
    return item;
  }

  private JMenuItem createChannelMenuItem(final Channel channel) {
    Icon icon = null;
    if (Settings.propShowChannelIconsInChannellist.getBoolean()) {
      icon = UiUtilities.createChannelIcon(channel.getIcon());
    }
    JMenuItem item = new JMenuItem(channel.getName(), icon);
    item.addActionListener(new ActionListener() {
View Full Code Here

    mPluginsMenu.add(mPluginManagerMI);
  }

  private JMenuItem createMenuItem(ActionMenu menu) {
    JMenuItem result;
    Icon icon = (Icon) menu.getAction().getValue(Action.SMALL_ICON);
    if (icon != null) {
      // resize any icon that is not a channel icon
      if (icon.getIconWidth() != 42 || icon.getIconHeight() != 22) {
        icon = new FixedSizeIcon(16, 16, icon);
      }
    }
    if (menu.hasSubItems()) {
      result = new ScrollableMenu(menu.getTitle());
View Full Code Here

    // Use an uneditable editor pane to let user select text in dialog
    JEditorPane messagePane = new JEditorPane("text/html", message);
    messagePane.setOpaque(false);
    messagePane.setEditable(false);
    String title = this.preferences.getLocalizedString(EditorPane.class, "about.title");
    Icon   icon  = new ImageIcon(EditorPane.class.getResource(
        this.preferences.getLocalizedString(EditorPane.class, "about.icon")));
    JOptionPane.showMessageDialog(SwingUtilities.getRootPane(this),
        messagePane, title, JOptionPane.INFORMATION_MESSAGE, icon);
  }
View Full Code Here

    }

    JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

    if (value instanceof PluginProxy || value instanceof InternalPluginProxyIf || value instanceof TvDataServiceProxy) {
      Icon iconValue = null;
      String nameValue = null;
      String descValue = null;
      boolean isActivated = true;

      if (value instanceof PluginProxy) {
View Full Code Here

      return new ToolTipWithIcon(null, null);
    }
    boolean showIcon = false;
    boolean showText = false;
    JToolTip tip;
    Icon channelIcon = mChannel.getIcon();
    if (channelIcon != null && channelIcon instanceof ImageIcon) {
      Icon shownIcon = this.getIcon();
      if (shownIcon != null && (channelIcon.getIconHeight() > shownIcon.getIconHeight() || channelIcon.getIconWidth() > shownIcon.getIconWidth())) {
        showIcon = true;
      }
    }
    if (showIcon) {
      tip = new ToolTipWithIcon((ImageIcon) channelIcon);
View Full Code Here

  @Override
  public Point getToolTipLocation(MouseEvent event) {
    FontMetrics metrics = this.getFontMetrics(this.getFont());
    int stringWidth = SwingUtilities.computeStringWidth(metrics, this.getText());
    int x = 0;
    Icon icon = this.getIcon();

    int iconWidth = getIcon().getIconWidth();
    if (mChannel.getIcon() != null) {
      iconWidth = mChannel.getIcon().getIconWidth();
    }

    int iconHeight = getIcon().getIconHeight();
    if (mChannel.getIcon() != null) {
      iconHeight = mChannel.getIcon().getIconHeight();
    }

    if (icon != null) {
      x = (this.getWidth() - stringWidth - this.getIconTextGap() - icon.getIconWidth()) / 2;
      if (x < 0) {
        x = 0;
      }
      x += (icon.getIconWidth() - iconWidth) / 2;
    }
    int y = (this.getHeight() - iconHeight - 2) / 2;
    return new Point(x, y);
  }
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.