Java Utililty Methods Graphics Settings

List of utility methods to do Graphics Settings

  1. HOME
  2. Java
  3. G
  4. Graphics Settings

Description

The list of methods to do Graphics Settings are organized into topic(s).

Method

GraphicsConfiguration getDefaultConfig()
get Default Config
return GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
GraphicsConfiguration getDefaultConfiguration()
get Default Configuration
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
return gd.getDefaultConfiguration();
GraphicsConfiguration getDefaultGraphicsConfiguration()
get Default Graphics Configuration
try {
 GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
 if (!env.isHeadlessInstance()) {
 return env.getDefaultScreenDevice().getDefaultConfiguration();
} catch (LinkageError e) {
 VM_SUPPORTS_ACCELERATION = false;
return null;
GraphicsConfiguration getDefaultGraphicsConfiguration()
Return the default graphics configuration.
try {
 return getDefaultScreenDevice().getDefaultConfiguration();
} catch (Exception e) {
 return null;
java.awt.GraphicsConfiguration getDefaultGraphicsConfiguration()
get Default Graphics Configuration
java.awt.GraphicsEnvironment ge = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
java.awt.GraphicsDevice gd = ge.getDefaultScreenDevice();
return gd.getDefaultConfiguration();
Rectangle getMaxWindowBounds(final GraphicsConfiguration gc, final boolean applyScreenInsets)
Returns maximum window bounds for the specified graphics configuration.
if (gc != null) {
 final Rectangle b = gc.getBounds();
 if (applyScreenInsets) {
 final Insets si = Toolkit.getDefaultToolkit().getScreenInsets(gc);
 return new Rectangle(si.left, si.top, b.width - si.left - si.right, b.height - si.top - si.bottom);
 } else {
 return new Rectangle(0, 0, b.width, b.height);
} else {
 return GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
Map getRenderingHints(final Graphics2D g2d, final Map hintsToSave, Map savedHints)
Returns map with rendering hints from a Graphics instance.
if (savedHints == null) {
 savedHints = new RenderingHints(null);
} else {
 savedHints.clear();
if (hintsToSave == null || hintsToSave.size() == 0) {
 return savedHints;
final Set objects = hintsToSave.keySet();
for (final Object o : objects) {
 final RenderingHints.Key key = (RenderingHints.Key) o;
 final Object value = g2d.getRenderingHint(key);
 if (value != null) {
 savedHints.put(key, value);
return savedHints;
RenderingHints getRenderingHints(Graphics2D g2d, Map hintsToSave, RenderingHints savedHints)
Get rendering hints from a Graphics instance.
if (savedHints == null)
 savedHints = new RenderingHints(null);
else
 savedHints.clear();
if (hintsToSave.isEmpty())
 return savedHints;
for (Object o : hintsToSave.keySet()) {
 RenderingHints.Key key = (RenderingHints.Key) o;
...
RenderingHints getRenderingHints(Graphics2D g2d, RenderingHints hintsToSave, RenderingHints savedHints)
Get rendering hints from a Graphics instance.
if (savedHints == null) {
 savedHints = new RenderingHints(null);
} else {
 savedHints.clear();
if (hintsToSave == null || hintsToSave.size() == 0) {
 return savedHints;
Set objects = hintsToSave.keySet();
for (Object o : objects) {
 RenderingHints.Key key = (RenderingHints.Key) o;
 Object value = g2d.getRenderingHint(key);
 savedHints.put(key, value);
return savedHints;
GraphicsConfiguration getSecondWindowConfiguration()
get Second Window Configuration
GraphicsDevice[] screens = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
if (screens.length < 2) {
 return null;
return screens[1].getDefaultConfiguration();


AltStyle によって変換されたページ (->オリジナル) /