Java Code Examples for javax.swing.GrayFilter#createDisabledImage()
The following examples show how to use
javax.swing.GrayFilter#createDisabledImage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NimbusLookAndFeel.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 2
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 3
Source File: NimbusLookAndFeel.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 4
Source File: NimbusLookAndFeel.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 5
Source File: NimbusLookAndFeel.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 6
Source File: ImageView.java From Bytecoder with Apache License 2.0 | 5 votes |
private Image getImage(boolean enabled) { Image img = getImage(); if (! enabled) { if (disabledImage == null) { disabledImage = GrayFilter.createDisabledImage(img); } img = disabledImage; } return img; }
Example 7
Source File: NimbusLookAndFeel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 8
Source File: NimbusLookAndFeel.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 9
Source File: NimbusLookAndFeel.java From Java8CN with Apache License 2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 10
Source File: NimbusLookAndFeel.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 11
Source File: BiNode.java From netbeans with Apache License 2.0 | 5 votes |
@Override public java.awt.Image getIcon( int type ){ if( key == BiFeature.Descriptor.class && biAnalyser.isNullDescriptor() ) return GrayFilter.createDisabledImage(super.getIcon(type)); if( key == BiFeature.Property.class && biAnalyser.isNullProperties() ) return GrayFilter.createDisabledImage(super.getIcon(type)); if( key == BiFeature.EventSet.class && biAnalyser.isNullEventSets() ) return GrayFilter.createDisabledImage(super.getIcon(type)); if( key == BiFeature.Method.class && biAnalyser.isNullMethods() ) return GrayFilter.createDisabledImage(super.getIcon(type)); return super.getIcon(type); }
Example 12
Source File: NimbusLookAndFeel.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 13
Source File: NimbusLookAndFeel.java From JDKSourceCode1.8 with MIT License | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 14
Source File: NimbusLookAndFeel.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 15
Source File: NimbusLookAndFeel.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Icon getDisabledIcon(JComponent component, Icon icon) { if (icon instanceof SynthIcon) { SynthIcon si = (SynthIcon)icon; BufferedImage img = EffectUtils.createCompatibleTranslucentImage( si.getIconWidth(), si.getIconHeight()); Graphics2D gfx = img.createGraphics(); si.paintIcon(component, gfx, 0, 0); gfx.dispose(); return new ImageIconUIResource(GrayFilter.createDisabledImage(img)); } else { return super.getDisabledIcon(component, icon); } }
Example 16
Source File: MultiResolutionDisabledImageTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void testMRDisabledImage(Image image) throws Exception { Image disabledImage = GrayFilter.createDisabledImage(image); MediaTracker mediaTracker = new MediaTracker(new JLabel()); mediaTracker.addImage(disabledImage, 0); mediaTracker.waitForID(0); BufferedImage buffImage = new BufferedImage(IMAGE_SIZE, IMAGE_SIZE, BufferedImage.TYPE_INT_RGB); int x = IMAGE_SIZE / 2; int y = IMAGE_SIZE / 2; Graphics2D g = buffImage.createGraphics(); g.scale(1, 1); g.drawImage(disabledImage, 0, 0, null); int rgb1x = buffImage.getRGB(x, y); g.scale(2, 2); g.drawImage(disabledImage, 0, 0, null); int rgb2x = buffImage.getRGB(x, y); g.dispose(); if (rgb1x == rgb2x) { throw new RuntimeException("Disabled image is the same for the base" + "image and the resolution variant"); } }
Example 17
Source File: ProjectsSelector.java From netbeans with Apache License 2.0 | 4 votes |
private static Icon disabledIcon(Icon icon) { return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); }
Example 18
Source File: Utils.java From netbeans with Apache License 2.0 | 4 votes |
private static Icon disabledIcon(Icon icon) { return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); }
Example 19
Source File: ProjectsSelector.java From visualvm with GNU General Public License v2.0 | 4 votes |
private static Icon disabledIcon(Icon icon) { return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage())); }
Example 20
Source File: ImageUtil.java From runelite with BSD 2-Clause "Simplified" License | 2 votes |
/** * Creates a grayscale image from the given image. * * @param image The source image to be converted. * @return A copy of the given imnage, with colors converted to grayscale. */ public static BufferedImage grayscaleImage(final BufferedImage image) { final Image grayImage = GrayFilter.createDisabledImage(image); return ImageUtil.bufferedImageFromImage(grayImage); }