本文整理匯總了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: */ }
示例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;
}
示例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;
}
示例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
}
示例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;
}
示例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();
}
示例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);
}
}
}
示例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);
}
}
}
示例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()
);
}
示例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);
}
}
示例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--;
}
}
示例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--;
}
}
示例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));
}
}
}
示例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));
}
}
}
示例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: */ }