当前位置: 首页>>代码示例>>Java>>正文


Java Key类代码示例

本文整理汇总了Java中java.awt.RenderingHints.Key的典型用法代码示例。如果您正苦于以下问题:Java Key类的具体用法?Java Key怎么用?Java Key使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Key类属于java.awt.RenderingHints包,在下文中一共展示了Key类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: installDesktopHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
private static Map installDesktopHints(Graphics2D g2)
/*  72:    */   {
/*  73:149 */     Map oldRenderingHints = null;
/*  74:150 */     if (LookUtils.IS_JAVA_6_OR_LATER)
/*  75:    */     {
/*  76:151 */       Map desktopHints = desktopHints(g2);
/*  77:152 */       if ((desktopHints != null) && (!desktopHints.isEmpty()))
/*  78:    */       {
/*  79:153 */         oldRenderingHints = new HashMap(desktopHints.size());
/*  80:155 */         for (Iterator i = desktopHints.keySet().iterator(); i.hasNext();)
/*  81:    */         {
/*  82:156 */           RenderingHints.Key key = (RenderingHints.Key)i.next();
/*  83:157 */           oldRenderingHints.put(key, g2.getRenderingHint(key));
/*  84:    */         }
/*  85:159 */         g2.addRenderingHints(desktopHints);
/*  86:    */       }
/*  87:    */     }
/*  88:162 */     return oldRenderingHints;
/*  89:    */   }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:20,代码来源:RenderingUtils.java

示例2: buildMenuCheckBoxes

import java.awt.RenderingHints.Key; //导入依赖的package包/类
private JMenu buildMenuCheckBoxes(JMenu root, Key key, Object[] values) {
	ButtonGroup       group = new ButtonGroup();
	JCheckBoxMenuItem item  = null;
	
	for(int i = 0; i < values.length; i++) {
		item = new JCheckBoxMenuItem(values[i].toString());
		group.add(item);
		item.addItemListener(new MenuItemListener(key, values[i]));
		root.add(item);
		
		if (item.getText().matches(".*default.*|.*Default.*|.*DEFAULT.*"))
			item.setSelected(true);
	}

	return root;
}
 
开发者ID:gentunian,项目名称:tellapic,代码行数:17,代码来源:PaintPropertyView.java

示例3: shrink

import java.awt.RenderingHints.Key; //导入依赖的package包/类
public static BufferedImage shrink(InputStream is, int maxWidth, int maxHeight, Map<Key, Object> hints) throws IOException {
	BufferedImage image;
	try {
		image = ImageIO.read(is);
	} catch (IOException e) {
		throw e;
	}
	
	double scale = calcScale(image.getWidth(), image.getHeight(), maxWidth, maxHeight);
	if (1.0 <= scale) {
		// FIXME
	}
	
	BufferedImage shrinkImage = resize(image, scale, hints);
	return shrinkImage;
}
 
开发者ID:mifmi,项目名称:mifmi-commons4j,代码行数:17,代码来源:ImageUtilz.java

示例4: referencingFactoryContainer

import java.awt.RenderingHints.Key; //导入依赖的package包/类
void referencingFactoryContainer() {
    Object datumFactory = null;
    Object csFactory = null;
    Object crsFactory = null;
    Object mtFactory = null;
    
    // referencingFactoryContainer start
    Map<Key, Object> map = new HashMap<Key, Object>();
    
    map.put(Hints.DATUM_FACTORY, datumFactory);
    map.put(Hints.CS_FACTORY, csFactory);
    map.put(Hints.CRS_FACTORY, crsFactory);
    map.put(Hints.MATH_TRANSFORM_FACTORY, mtFactory);
    
    Hints hints = new Hints(map);
    
    ReferencingFactoryContainer container = new ReferencingFactoryContainer(hints);
    // referencingFactoryContainer end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:ReferencingExamples.java

示例5: installDesktopHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
private static Map installDesktopHints(Graphics2D g2)
{
  Map oldRenderingHints = null;
  if (LookUtils.IS_JAVA_6_OR_LATER) {
    Map desktopHints = desktopHints(g2);
    if ((desktopHints != null) && (!desktopHints.isEmpty())) {
      oldRenderingHints = new HashMap(desktopHints.size());

      for (Iterator i = desktopHints.keySet().iterator(); i.hasNext(); ) {
        RenderingHints.Key key = (RenderingHints.Key)i.next();
        oldRenderingHints.put(key, g2.getRenderingHint(key));
      }
      g2.addRenderingHints(desktopHints);
    }
  }
  return oldRenderingHints;
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:18,代码来源:RenderingUtils.java

示例6: setRenderingHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
/**
 * Sets the preferences for the rendering algorithms.
 * Hint categories include controls for rendering quality and
 * overall time/quality trade-off in the rendering process.
 * @param hints The rendering hints to be set
 * @see RenderingHints
 */
public void setRenderingHints(Map<?,?> hints) {
    this.hints = null;
    renderHint = SunHints.INTVAL_RENDER_DEFAULT;
    antialiasHint = SunHints.INTVAL_ANTIALIAS_OFF;
    textAntialiasHint = SunHints.INTVAL_TEXT_ANTIALIAS_DEFAULT;
    fractionalMetricsHint = SunHints.INTVAL_FRACTIONALMETRICS_OFF;
    lcdTextContrast = lcdTextContrastDefaultValue;
    interpolationHint = -1;
    interpolationType = AffineTransformOp.TYPE_NEAREST_NEIGHBOR;
    boolean customHintPresent = false;
    Iterator<?> iter = hints.keySet().iterator();
    while (iter.hasNext()) {
        Object key = iter.next();
        if (key == SunHints.KEY_RENDERING ||
            key == SunHints.KEY_ANTIALIASING ||
            key == SunHints.KEY_TEXT_ANTIALIASING ||
            key == SunHints.KEY_FRACTIONALMETRICS ||
            key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST ||
            key == SunHints.KEY_STROKE_CONTROL ||
            key == SunHints.KEY_INTERPOLATION)
        {
            setRenderingHint((Key) key, hints.get(key));
        } else {
            customHintPresent = true;
        }
    }
    if (customHintPresent) {
        this.hints = makeHints(hints);
    }
    invalidatePipe();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:SunGraphics2D.java

示例7: addRenderingHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
/**
 * Adds a number of preferences for the rendering algorithms.
 * Hint categories include controls for rendering quality and
 * overall time/quality trade-off in the rendering process.
 * @param hints The rendering hints to be set
 * @see RenderingHints
 */
public void addRenderingHints(Map<?,?> hints) {
    boolean customHintPresent = false;
    Iterator<?> iter = hints.keySet().iterator();
    while (iter.hasNext()) {
        Object key = iter.next();
        if (key == SunHints.KEY_RENDERING ||
            key == SunHints.KEY_ANTIALIASING ||
            key == SunHints.KEY_TEXT_ANTIALIASING ||
            key == SunHints.KEY_FRACTIONALMETRICS ||
            key == SunHints.KEY_TEXT_ANTIALIAS_LCD_CONTRAST ||
            key == SunHints.KEY_STROKE_CONTROL ||
            key == SunHints.KEY_INTERPOLATION)
        {
            setRenderingHint((Key) key, hints.get(key));
        } else {
            customHintPresent = true;
        }
    }
    if (customHintPresent) {
        if (this.hints == null) {
            this.hints = makeHints(hints);
        } else {
            this.hints.putAll(hints);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:SunGraphics2D.java

示例8: setRenderingHint

import java.awt.RenderingHints.Key; //导入依赖的package包/类
/**
 * Sets a rendering hint
 * @param arg0
 * @param arg1
 */
public void setRenderingHint(Key arg0, Object arg1) {
	 if (arg1 != null) {
     	rhints.put(arg0, arg1);
     } else {
    	 if (arg0 instanceof HyperLinkKey)
    	 {
    		 rhints.put(arg0, HyperLinkKey.VALUE_HYPERLINKKEY_OFF);
    	 }
    	 else
    	 {
    		 rhints.remove(arg0);
    	 }
     }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:20,代码来源:PdfGraphics2D.java

示例9: NullResizer

import java.awt.RenderingHints.Key; //导入依赖的package包/类
/**
 * Instantiates the {@code NullResizer} which draws the source image at
 * the origin of the destination image.
 */
public NullResizer()
{
	this(
			RenderingHints.VALUE_INTERPOLATION_BILINEAR,
			Collections.<Key, Object>emptyMap()
	);
}
 
开发者ID:farhan,项目名称:Android-Image-Resizer-Module,代码行数:12,代码来源:NullResizer.java

示例10: setRenderingHint

import java.awt.RenderingHints.Key; //导入依赖的package包/类
@Override
public void setRenderingHint(Key hintKey, Object hintValue) {
	if(hintValue==null) {
		hints.remove(hintKey);
	} else {
		hints.put(hintKey, hintValue);
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:9,代码来源:AbstractGraphics2D.java

示例11: getRenderingHint

import java.awt.RenderingHints.Key; //导入依赖的package包/类
public Object getRenderingHint(Key hintKey) {
	if(output) {
		System.out.println(i()+"getRenderingHint( "+hintKey+" )");
	}
	indent++;
	try {
		Object returnValue = g.getRenderingHint(hintKey);
		System.out.println(i()+" = "+returnValue);
		return returnValue;
	} finally {
		indent--;
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:14,代码来源:VerboseGraphics2D.java

示例12: setRenderingHint

import java.awt.RenderingHints.Key; //导入依赖的package包/类
public void setRenderingHint(Key hintKey, Object hintValue) {
	if(output) {
		System.out.println(i()+"setRenderingHint( "+hintKey+", "+hintValue+" )");
	}
	indent++;
	try {
		g.setRenderingHint(hintKey, hintValue);
	} finally {
		indent--;
	}
}
 
开发者ID:mickleness,项目名称:pumpernickel,代码行数:12,代码来源:VerboseGraphics2D.java

示例13: setRenderingHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
@Override
public void setRenderingHints(final Map<?, ?> hints) {
	renderingHint.clear();
	
	final Iterator it = hints.keySet().iterator();
	while(it.hasNext()){
		final Object key = it.next();
		if(key instanceof Key){
			renderingHint.put(key, hints.get(key));
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:13,代码来源:CanvasGraphics.java

示例14: addRenderingHints

import java.awt.RenderingHints.Key; //导入依赖的package包/类
@Override
public void addRenderingHints(final Map<?, ?> hints) {
	final Iterator it = hints.keySet().iterator();
	while(it.hasNext()){
		final Object key = it.next();
		if(key instanceof Key){
			renderingHint.put(key, hints.get(key));
		}
	}
}
 
开发者ID:javalovercn,项目名称:j2se_for_android,代码行数:11,代码来源:CanvasGraphics.java

示例15: paintIcon

import java.awt.RenderingHints.Key; //导入依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y)
/*  60:    */     {
/*  61:103 */       JCheckBox cb = (JCheckBox)c;
/*  62:104 */       ButtonModel model = cb.getModel();
/*  63:105 */       Graphics2D g2 = (Graphics2D)g;
/*  64:106 */       boolean paintFocus = ((model.isArmed()) && (!model.isPressed())) || ((cb.hasFocus()) && (PlasticXPIconFactory.isBlank(cb.getText())));
/*  65:    */       
/*  66:    */ 
/*  67:109 */       RenderingHints.Key key = RenderingHints.KEY_ANTIALIASING;
/*  68:110 */       Object newAAHint = RenderingHints.VALUE_ANTIALIAS_ON;
/*  69:111 */       Object oldAAHint = g2.getRenderingHint(key);
/*  70:112 */       if (newAAHint != oldAAHint) {
/*  71:113 */         g2.setRenderingHint(key, newAAHint);
/*  72:    */       } else {
/*  73:115 */         oldAAHint = null;
/*  74:    */       }
/*  75:118 */       drawBorder(g2, model.isEnabled(), x, y, SIZE - 1, SIZE - 1);
/*  76:119 */       drawFill(g2, model.isPressed(), x + 1, y + 1, SIZE - 2, SIZE - 2);
/*  77:120 */       if (paintFocus) {
/*  78:121 */         drawFocus(g2, x + 1, y + 1, SIZE - 3, SIZE - 3);
/*  79:    */       }
/*  80:123 */       if (model.isSelected()) {
/*  81:124 */         drawCheck(g2, model.isEnabled(), x + 3, y + 3, SIZE - 7, SIZE - 7);
/*  82:    */       }
/*  83:127 */       if (oldAAHint != null) {
/*  84:128 */         g2.setRenderingHint(key, oldAAHint);
/*  85:    */       }
/*  86:    */     }
 
开发者ID:xiwc,项目名称:confluence.keygen,代码行数:29,代码来源:PlasticXPIconFactory.java


注:本文中的java.awt.RenderingHints.Key类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。