本文整理汇总了Java中javax.swing.GrayFilter.createDisabledImage方法的典型用法代码示例。如果您正苦于以下问题:Java GrayFilter.createDisabledImage方法的具体用法?Java GrayFilter.createDisabledImage怎么用?Java GrayFilter.createDisabledImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.GrayFilter
的用法示例。
在下文中一共展示了GrayFilter.createDisabledImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
@Override
public java.awt.Image getIcon( int type ){
if( biFeature instanceof BiFeature.Descriptor && biAnalyser.isNullDescriptor() ) {
//setIconBase( biFeature.getIconBase(true));
return GrayFilter.createDisabledImage(super.getIcon(type));
}
if( ( biFeature instanceof BiFeature.Property || biFeature instanceof BiFeature.IdxProperty ) && biAnalyser.isNullProperties() ) {
//setIconBase( biFeature.getIconBase(true));
return GrayFilter.createDisabledImage(super.getIcon(type));
}
if( biFeature instanceof BiFeature.EventSet && biAnalyser.isNullEventSets() ) {
//setIconBase( biFeature.getIconBase(true));
return GrayFilter.createDisabledImage(super.getIcon(type));
}
if( biFeature instanceof BiFeature.Method && biAnalyser.isNullMethods() ) {
//setIconBase( biFeature.getIconBase(true));
return GrayFilter.createDisabledImage(super.getIcon(type));
}
//setIconBase( biFeature.getIconBase(false));
return super.getIcon(type);
}
示例2: getDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
public static XBIcon getDisabledIcon(int which, boolean selected) {
if( which<0 || which>=disIcons.length ) return getDefaultIcon(selected);
int i = selected ? 1 : 0;
if( disIcons[which][i]!=null )return disIcons[which][i];
int i1 = (i+1)%2;
if( disIcons[which][i1]!=null ) {
disIcons[which][i] = new XBIcon(disIcons[which][i1].getImage(), selected);
return disIcons[which][i];
}
try {
if( loader==null ) {
loader = org.geomapapp.util.Icons.class.getClassLoader();
}
String path = "org/geomapapp/resources/icons/" +names[which];
java.net.URL url = loader.getResource(path);
BufferedImage im = ImageIO.read(url);
Image im1 = GrayFilter.createDisabledImage(im);
Graphics g = im.createGraphics();
g.drawImage(im1,0,0, new JPanel() );
disIcons[which][i] = new XBIcon(im, selected);
} catch(Exception ex) {
return getDefaultIcon(selected);
}
return disIcons[which][i];
}
示例3: getGrayedImage
import javax.swing.GrayFilter; //导入方法依赖的package包/类
@Override
public Image getGrayedImage( final boolean cache ) {
Image grayedImage = this.grayedImage;
if ( grayedImage == null ) {
grayedImage = GrayFilter.createDisabledImage( get( cache ).getImage() );
if ( cache )
this.grayedImage = grayedImage;
// The Java image API uses asynchronous image processing, wait for the grayed image to complete
// in order to avoid empty images being displayed!
final int id = ID_GENERATOR.getAndIncrement();
MEDIA_TRACKER.addImage( grayedImage, id );
try {
MEDIA_TRACKER.waitForID( id );
} catch ( final InterruptedException ie ) {
LEnv.LOGGER.warning( "Image conversion (graying) interrupted!", ie );
} finally {
MEDIA_TRACKER.removeImage( grayedImage, id );
}
}
return grayedImage;
}
示例4: getDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
/**
* Uses the uimanager to get a grayscaled disabled Icon
*
* @param icon
* @return
*/
public static Icon getDisabledIcon(Icon icon) {
if (icon == null) { return null; }
synchronized (ImageProvider.LOCK) {
final MinTimeWeakReference<Icon> cache = ImageProvider.DISABLED_ICON_CACHE.get(icon);
Icon ret = cache == null ? null : cache.get();
if (ret != null) {
//
return ret;
}
if (!(icon instanceof ImageIcon)) {
// getDisabledIcon only works for imageicons
icon = ImageProvider.toImageIcon(icon);
}
ret = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) icon).getImage()));
ImageProvider.DISABLED_ICON_CACHE.put(icon, new MinTimeWeakReference<Icon>(ret, ImageProvider.MIN_LIFETIME, "disabled icon"));
return ret;
}
}
示例5: getIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
@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);
}
示例6: getOpenedIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
@Override
public java.awt.Image getOpenedIcon( 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.getOpenedIcon(type);
}
示例7: getDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
@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);
}
}
示例8: testMRDisabledImage
import javax.swing.GrayFilter; //导入方法依赖的package包/类
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");
}
}
示例9: createDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
/**
* Create a disabled icon using a gray filter.
*/
public static Icon createDisabledIcon(ImageIcon imageIcon) {
Image i =
GrayFilter.createDisabledImage(
imageIcon.getImage() );
return new ImageIcon(i);
}
示例10: getDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
/**
* Returns an icon with a disabled appearance. This method is used
* to generate a disabled icon when one has not been specified.
*
* @param component the component that will display the icon, may be null.
* @param icon the icon to generate disabled icon from.
* @return disabled icon, or null if a suitable icon can not be generated.
*/
public static Icon getDisabledIcon(JComponent component, Icon icon) {
if ( (icon == null)
|| (component == null)
|| (icon.getIconWidth() == 0)
|| (icon.getIconHeight() == 0)) {
return null;
}
Image img;
if (icon instanceof ImageIcon) {
img = ((ImageIcon) icon).getImage();
} else {
img = new BufferedImage(
icon.getIconWidth(),
icon.getIconHeight(),
BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(component, img.getGraphics(), 0, 0);
}
if ( !Options.isHiResGrayFilterEnabled()
|| (Boolean.FALSE.equals(component.getClientProperty(Options.HI_RES_DISABLED_ICON_CLIENT_KEY)))) {
return new ImageIcon(GrayFilter.createDisabledImage(img));
}
ImageProducer producer =
new FilteredImageSource(img.getSource(), new RGBGrayFilter());
return new ImageIcon(component.createImage(producer));
}
示例11: disabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
private static Icon disabledIcon(Icon icon) {
return new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon)icon).getImage()));
}
示例12: init
import javax.swing.GrayFilter; //导入方法依赖的package包/类
public static void init(GraphicsConfiguration gc) {
try
{
//System.out.println("Image Directory: " + img);
// System.out.println(curDir);
level = cutImage(gc, "mapsheet.png", 16, 16); //level graphics
bg = cutImage(gc, "bgsheet.png", 520, 256); //background graphics
//map = cutImage(gc, "worldmap.png", 16, 16); //TODO: obsolete graphics?
enemies = cutImage(gc, "enemysheet.png", 16, 32);
items = cutImage(gc, "itemsheet.png", 16, 16);
particles = cutImage(gc, "particlesheet.png", 8, 8);
waiting = cutImage(gc, "gearsSmall.png", 16,16);
// play = cutImage(gc, "play128.png",16,16);
// pause = cutImage(gc, "pause128.png",16,16);
//logo = getImage(gc, "logo.gif");
//titleScreen = getImage(gc, "title.gif");
//font = cutImage(gc, "font.gif", 8, 8);
//endScene = cutImage(gc, "endscene.gif", 96, 96);
//gameOver = cutImage(gc, "gameovergost.gif", 96, 64);
camera = cutImage(gc, "camera.png", 50, 50);
computer = cutImage(gc, "computer.png", 50, 50);
microphone = cutImage(gc, "microphone.png", 50, 50);
dreamCatcher = cutImage(gc, "dreamCatcherSmall.png", 50, 50);
Maria = cutImage(gc, "Maria_M_Enditem.png", 50, 50);
cursor = cutImage(gc, "cursor.png", 20, 20);
clark = cutImage(gc, "clark_sheet.png", 32, 32);
smallClark = cutImage(gc, "clark_small_sheet.png", 32, 32);
bulbClark = cutImage(gc, "clark_bulb_sheet.png", 32, 32);
jay = cutImage(gc, "jay_sheet.png", 32, 32);
smallJay = cutImage(gc, "jay_small_sheet.png", 32, 32);
bulbJay = cutImage(gc, "jay_bulb_sheet.png", 32, 32);
peter = cutImage(gc, "peter_sheet.png", 32, 32);
smallPeter = cutImage(gc, "peter_small_sheet.png", 32, 32);
bulbPeter = cutImage(gc, "peter_bulb_sheet.png", 32, 32);
bruce = cutImage(gc, "bruce_sheet.png", 32, 32);
smallBruce = cutImage(gc, "bruce_small_sheet.png", 32, 32);
bulbBruce = cutImage(gc, "bruce_bulb_sheet.png", 32, 32);
String path = ResourceStream.DIR_WORLD_RESOURCES+"/engine/resources/play32.png";
play = ImageIO.read(ResourceStream.getResourceStream(path));
// play = createResizedCopy(img,24, 24, true);
path = ResourceStream.DIR_WORLD_RESOURCES+"/engine/resources/pause32.png";
pause = ImageIO.read(ResourceStream.getResourceStream(path));
path = ResourceStream.DIR_WORLD_RESOURCES+"/engine/resources/speaker32.png";
speaker = ImageIO.read(ResourceStream.getResourceStream(path));
path = ResourceStream.DIR_WORLD_RESOURCES+"/engine/resources/mute32.png";
mute = ImageIO.read(ResourceStream.getResourceStream(path));
health = getImage(gc, "health.png");
grayHealth = GrayFilter.createDisabledImage(health);
curiosity = getImage(gc, "curiosity.png");
grayCuriosity = GrayFilter.createDisabledImage(curiosity);
progress = getImage(gc, "progress.png");
grayProgress = GrayFilter.createDisabledImage(progress);
energy = getImage(gc, "energy.png");
grayEnergy = GrayFilter.createDisabledImage(energy);
System.out.println("Done loading arts");
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例13: ShadowedIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
public ShadowedIcon(Icon icon) {
this.icon = icon;
shadow = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) icon).getImage()));
}
示例14: getTreeCellRendererComponent
import javax.swing.GrayFilter; //导入方法依赖的package包/类
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus){
Component renderer = delegate.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
PatternNode visibleNode = ((PatternNode) value);
AbstractButton button = checkBox;
TreePath path = tree.getPathForRow(row);
if(path!=null) {
TristateButtonModel tristateModel = checkBox.getTristateModel();
/*
* Important! Only the GUI reverses the selection logic, which means
* that a visible selected check box actually represents an
* unselected check box, whereas an unselected check box stands for
* a selected one. Indeterminate stays indeterminate. This is a hack
* to avoid recoding of the entire model, but may be cleaned up in
* the future.
*/
if(selectionModel.isPathSelected(path)) {
// tristateModel.setSelected(true);
tristateModel.setSelected(false);
} else if (selectionModel.isPartiallySelected(path)) {
tristateModel.setIndeterminate();
button = radioButton;
} else {
// tristateModel.setSelected(false);
tristateModel.setSelected(true);
}
}
removeAll();
button.setEnabled(enabledDisabledButtons || !visibleNode.isDisabled());
renderer.setEnabled(enabledDisabledButtons || !visibleNode.isDisabled());
if (visibleNode.isDisabled()) {
JLabel label = (JLabel) renderer;
Icon icon = label.getIcon();
Icon disabledIcon;
// only set disabled icon, if icon is not null
if (icon != null) {
if (disabledIconsMap.containsKey(icon)) {
disabledIcon = disabledIconsMap.get(icon);
} else {
Image img = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
icon.paintIcon(new JPanel(), img.getGraphics(), 0, 0);
disabledIcon = new ImageIcon(GrayFilter.createDisabledImage(img));
disabledIconsMap.put(icon, disabledIcon);
}
label.setDisabledIcon(disabledIcon);
}
}
add(button, BorderLayout.WEST);
add(renderer, BorderLayout.CENTER);
return this;
}
示例15: createDisabledIcon
import javax.swing.GrayFilter; //导入方法依赖的package包/类
/**
* Creates a grayed out version of this icon.
*
* @return the disabled icon
*/
public ScaledImageIcon createDisabledIcon() {
Image grayImage = GrayFilter.createDisabledImage(super.getImage());
return new ScaledImageIcon(grayImage, height, width);
}