import
java.awt.RenderingHints;
import
java.util.Collection;
import
java.util.HashMap;
import
java.util.Iterator;
import
java.util.Map;
import
java.util.Map.Entry;
import
java.util.Set;
public
class
RenderingHintsImpl
{
private
RenderingHints renderingHints;
public
RenderingHintsImpl(Map<RenderingHints.Key, ?> init)
{
renderingHints =
new
RenderingHints(init);
}
public
RenderingHintsImpl(RenderingHints.Key key,
Object value)
{
renderingHints =
new
RenderingHints(key, value);
}
public
void
add(RenderingHints hints)
{
renderingHints.add(hints);
}
public
void
clear() { renderingHints.clear(); }
public
Object clone() {
return
renderingHints.clone(); }
public
boolean
containsKey(Object key)
{
return
renderingHints.containsKey(key);
}
public
boolean
containsValue(Object value)
{
return
renderingHints.containsValue(value);
}
public
Set<Map.Entry<Object, Object> > entrySet()
{
return
renderingHints.entrySet();
}
public
Object get(Object key)
{
return
renderingHints.get(key);
}
public
boolean
isEmpty()
{
return
renderingHints.isEmpty();
}
public
Set<Object> keySet()
{
return
renderingHints.keySet();
}
public
Object put(Object key, Object value)
{
return
renderingHints.put(key, value);
}
public
void
putAll(Map<?, ?> m)
{
renderingHints.putAll(m);
}
public
Object remove(Object key)
{
return
renderingHints.remove(key);
}
public
int
size() {
return
renderingHints.size(); }
public
Collection<Object> values()
{
return
renderingHints.values();
}
public
static
void
main(String[] arg)
{
RenderingHintsImpl renderingHints =
new
RenderingHintsImpl(
RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
renderingHints.put(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
renderingHints.put(
RenderingHints.KEY_FRACTIONALMETRICS,
RenderingHints.VALUE_FRACTIONALMETRICS_ON);
renderingHints.put(
RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
Map<Object, Object> anotherMap =
new
HashMap<Object, Object>();
anotherMap.put(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_PURE);
anotherMap.put(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_ENABLE);
renderingHints.putAll(anotherMap);
System.out.println(
"the key set of the renderingHints is - "
);
Set<Object> keySet = renderingHints.keySet();
Iterator<Object> itr = keySet.iterator();
while
(itr.hasNext())
{
System.out.println(itr.next());
}
System.out.println();
System.out.println(
"the values of the renderingHints is -"
);
Collection<Object> collectionValues = renderingHints.values();
itr = collectionValues.iterator();
while
(itr.hasNext())
{
System.out.println(itr.next());
}
System.out.println();
System.out.println(
"the entry set of the renderingHints is -"
);
Iterator<Entry<Object, Object> > eitr;
Set<Entry<Object, Object> > entrySet = renderingHints.entrySet();
eitr = entrySet.iterator();
while
(eitr.hasNext())
{
System.out.println(eitr.next());
}
System.out.println(
"the renderingHints contains Key KEY_TEXT_ANTIALIASING :"
+ renderingHints.containsKey(RenderingHints.KEY_TEXT_ANTIALIASING));
System.out.println(
"the renderingHints contains Value VALUE_TEXT_ANTIALIAS_ON :"
+ renderingHints.containsValue(
RenderingHints.VALUE_TEXT_ANTIALIAS_ON));
System.out.println(
"the size of the renderingHints is :"
+ renderingHints.size());
renderingHints.clear();
if
(renderingHints.isEmpty())
System.out.println(
"The renderingHints is empty"
);
else
System.out.println(
"The renderingHints is not empty"
);
}
}