public void addIcon(final UIIcon uiIcon) { mIcons.add(uiIcon.getIcon()); mUIIcons.add(uiIcon); }
public void addIcon(final UIIcon uiIcon, final NodeModel node) { mIcons.add(uiIcon.getIcon(node)); mUIIcons.add(uiIcon); }
private Icon getZoomedBitmapIcon() { if (zoomedIcon == null) { Map<Float, ImageIcon> icons = zoomedBitmapIcons.get(uiIcon); if (icons == null) { icons = new HashMap<Float, ImageIcon>(); zoomedBitmapIcons.put(uiIcon, icons); } zoomedIcon = icons.get(zoom); if (zoomedIcon != null) { return zoomedIcon; } final Icon icon = uiIcon.getIcon(); final int width = icon.getIconWidth(); final int height = icon.getIconHeight(); final BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); final Graphics2D g = image.createGraphics(); icon.paintIcon(null, g, 0, 0); final Image scaledImage = image.getScaledInstance((int) (width * zoom), (int) (height * zoom), Image.SCALE_SMOOTH); zoomedIcon = new ImageIcon(scaledImage); icons.put(zoom, zoomedIcon); g.dispose(); } return zoomedIcon; }
private JButton[] createButtonRow(final int modifiers) { final JButton[] buttons = new JButton[BUTTON_NUMBER]; for (int i = 0; i < BUTTON_NUMBER; i++) { final String name = "f" + (i + 1) + ".png"; final JButton button = buttons[i] = new JButton(toImageIcon(IconStoreFactory.ICON_STORE.getUIIcon(name).getIcon())) { /** * */ private static final long serialVersionUID = 1L; @Override protected void configurePropertiesFromAction(final Action a) { } }; button.setFont(BUTTON_FONT); button.setFocusable(false); button.setBorder(BorderFactory.createEtchedBorder()); if (System.getProperty("os.name").startsWith("Mac OS")) { button.setBorderPainted(false); } KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_F1 + i, modifiers); setAcceleratorAction(button, ks); } return buttons; }
private Component getCellRendererComponent(final Object value, final boolean isSelected) { final JComponent component; if (value == null) { component = new JLabel(noValueText); } else if (value instanceof UIIcon) { component = new JLabel(((UIIcon) value).getIcon()); } else if (value instanceof ASelectableCondition) { final ASelectableCondition cond = (ASelectableCondition) value; final String userName = cond.getUserName(); if(renderNamedConditions || userName == null) component = cond.getListCellRendererComponent(); else { component = new JLabel(userName); component.setToolTipText(cond.createDescription()); } } else component = new JLabel(value.toString()); component.setOpaque(true); component.setAlignmentX(Component.LEFT_ALIGNMENT); return component; }
public JComponent createRendererComponent() { final JCondition component = new JCondition(); final String text = TextUtils.getText("filter_icon") + ' ' + TextUtils.getText("filter_contains") + ' '; component.add(ConditionFactory.createConditionLabel(text)); JLabel icon = ConditionFactory.createConditionLabel(STORE.getUIIcon(getIconName()).getIcon()); component.add(icon); icon.setBackground(Color.WHITE); icon.setOpaque(true); return component; }
private JMenu getSubmenu( final IconGroup group) { final JMenu menu = new JMenu("\u25ba") { private static final long serialVersionUID = 1L; @Override protected Point getPopupMenuOrigin() { return new Point(getWidth(), 0); } }; menu.setFont(ARROW_FONT); menu.setMargin(ICON_SUBMENU_INSETS); menu.setIcon(group.getGroupIcon().getIcon()); for (final MindIcon icon : group.getIcons()) { addActionToIconSubmenu(menu, icon, icon.getFileName()); } menu.setToolTipText(group.getDescription()); return menu; }
private void addIconGroup(final Entry target, final IconGroup group) { if (group.getIcons().size() < 1) { return; } final Entry item = new Entry(); EntryAccessor entryAccessor = new EntryAccessor(); entryAccessor.setIcon(item, group.getGroupIcon().getIcon()); item.setName(group.getDescriptionKey()); target.addChild(item); for (final MindIcon icon : group.getIcons()) { final String fileName = icon.getFileName(); addAction(item, "", icon, fileName); } }