Ignore:
Timestamp:
2012-08-30T22:38:56+02:00 (14 years ago)
Author:
Don-vip
Message:

Recently added tags: correctly select one-char-length values, properly gray out icon and text for disabled (already present) tags

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java

    r5297 r5484  
    77import java.awt.Container;
    88import java.awt.Image;
     9import java.awt.Toolkit;
     10import java.awt.image.FilteredImageSource;
    911import java.lang.reflect.InvocationTargetException;
    1012
     13import javax.swing.GrayFilter;
    1114import javax.swing.Icon;
    1215import javax.swing.ImageIcon;
     
    8083        return dlg.showDialog().getValue() != 2;
    8184    }
     85   
     86    /**
     87     * Replies the disabled (grayed) version of the specified image.
     88     * @param image The image to disable
     89     * @return The disabled (grayed) version of the specified image, brightened by 20%.
     90     * @since 5484
     91     */
     92    public static final Image getDisabledImage(Image image) {
     93        return Toolkit.getDefaultToolkit().createImage(
     94                new FilteredImageSource(image.getSource(), new GrayFilter(true, 20)));
     95    }
    8296
     97    /**
     98     * Replies the disabled (grayed) version of the specified icon.
     99     * @param icon The icon to disable
     100     * @return The disabled (grayed) version of the specified icon, brightened by 20%.
     101     * @since 5484
     102     */
     103    public static final ImageIcon getDisabledIcon(ImageIcon icon) {
     104        return new ImageIcon(getDisabledImage(icon.getImage()));
     105    }
    83106}
Note: See TracChangeset for help on using the changeset viewer.