Package javax.swing

Examples of javax.swing.Icon


        }
        return false;
    }

    private Icon getIcon(AbstractButton button) {
        Icon icon = button.getIcon();
        if (icon != null) {
            return icon;
        }
        String key = null;
        if (button instanceof JCheckBox) {
View Full Code Here


     */
    int getButtonChildIndent(JComponent c, int position) {
        if ((c instanceof JRadioButton) || (c instanceof JCheckBox)) {
            AbstractButton button = (AbstractButton)c;
            Insets insets = c.getInsets();
            Icon icon = getIcon(button);
            int gap = button.getIconTextGap();
            if (isLeftAligned(button, position)) {
                return insets.left + icon.getIconWidth() + gap;
            } else if (isRightAligned(button, position)) {
                return insets.right + icon.getIconWidth() + gap;
            }
        }
        return 0;
    }
View Full Code Here

    private int myAutoRepeatMilliseconds;

    public TestGanttRolloverButton(Action action) {
        this();
        setAction(action);
        Icon smallIcon = (Icon) action.getValue(Action.SMALL_ICON);
        if (smallIcon != null) {
            setIcon(smallIcon);
            _iconOff = smallIcon;
            myIcon = smallIcon;
        }
View Full Code Here

    }

    private JXDatePicker createDatePicker(ActionListener listener) {
        ImageIcon calendarImage = new ImageIcon(getClass().getResource(
        "/icons/calendar_16.gif"));
        Icon nextMonth = new ImageIcon(getClass()
                .getResource("/icons/nextmonth.gif"));
        Icon prevMonth = new ImageIcon(getClass()
                .getResource("/icons/prevmonth.gif"));
        UIManager.put("JXDatePicker.arrowDown.image", calendarImage);
        UIManager.put("JXMonthView.monthUp.image", prevMonth);
        UIManager.put("JXMonthView.monthDown.image", nextMonth);
        UIManager.put("JXMonthView.monthCurrent.image", calendarImage);
View Full Code Here

import javax.swing.JMenuItem;

public class ActionMenuItem extends JMenuItem {
    public ActionMenuItem(AppAction action) {
        super(action);
        Icon i = (Icon) action.getValue(AppAction.SMALL_ICON);
        if (i != null) {
            setIcon(i);
        }
    }
View Full Code Here

import javax.swing.JRadioButtonMenuItem;

public class ActionRadioButtonMenuItem extends JRadioButtonMenuItem {
    public ActionRadioButtonMenuItem(ToggleableAction action) {
        super(action);
        Icon i = (Icon) action.getValue(AppAction.SMALL_ICON);
        if (i != null) {
            setIcon(i);
        }
        action.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
View Full Code Here

            }
        });
        a.addPropertyChangeListener(new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals(iconKey)) {
                    Icon icon = (Icon) evt.getNewValue();
                    ActionButton.this.setIcon(icon);
                    ActionButton.this.invalidate();
                    ActionButton.this.repaint();
                }
            }
View Full Code Here

        // Now paint a gradient UNDER the ghosted JLabel text (but not under the
        // icon if any)
        // Note: this will need tweaking if your icon is not positioned to the
        // left of the text
        Icon icon = lbl.getIcon();
        int nStartOfText = (icon == null) ? 0 : icon.getIconWidth()
                + lbl.getIconTextGap();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER,
                0.5f)); // Make the gradient ghostlike
        g2.setPaint(new GradientPaint(nStartOfText, 0,
                SystemColor.controlShadow, getWidth(), 0, new Color(255, 255,
View Full Code Here

    public Icon getIconOnMouseOver() {
        return (Icon) getValue(Action.SMALL_ICON);
    }

    public void setIconSize(String iconSize) {
        Icon icon = createIcon(iconSize);
        if (icon != null) {
            putValue(Action.SMALL_ICON, icon);
            myIcon = icon;
        }
    }
View Full Code Here

    _categoryTree.setCellRenderer(new TreeCellRenderer() {

      @Override
      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
          boolean leaf, int row, boolean hasFocus) {
        Icon icon = null;

        JComponent result;
        Object userObject = ((DefaultMutableTreeNode) value).getUserObject();
        if (userObject instanceof Category) {
          // Used to render categories
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.