javax.media.j3d
Class GraphicsConfigTemplate3D

java.lang.Object
  extended by java.awt.GraphicsConfigTemplate
      extended by javax.media.j3d.GraphicsConfigTemplate3D
All Implemented Interfaces:
java.io.Serializable

public class GraphicsConfigTemplate3D
extends java.awt.GraphicsConfigTemplate

This class is used to obtain a valid GraphicsConfiguration that can be used by Java 3D. A user instantiates one of these objects and then sets all non-default attributes as desired. The getBestConfiguration() method in the GraphicsDevice class is then called with this GraphicsConfigTemplate and the "best" GraphicsConfiguration is returned. The "best" GraphicsConfiguration means that this GraphicsConfiguration is supported and it meets or exceeds what was requested in the GraphicsConfigTemplate. Null is returned if no such "best" GraphicsConfiguration is found.

See Also:
GraphicsConfigTemplate, GraphicsDevice, GraphicsConfiguration, Serialized Form

Field Summary
 
Fields inherited from class java.awt.GraphicsConfigTemplate
PREFERRED, REQUIRED, UNNECESSARY
 
Constructor Summary
GraphicsConfigTemplate3D()
          Constructs a GraphicsConfigTemplate3D object with default parameters.
 
Method Summary
 java.awt.GraphicsConfiguration getBestConfiguration(java.awt.GraphicsConfiguration[] gc)
          Implement the abstract function of getBestConfiguration() in GraphicsConfigTemplate.
 int getBlueSize()
          Retrieves the number of blue bits requested by this template.
 int getDepthSize()
          Retrieves the size of the depth buffer.
 int getDoubleBuffer()
          Retrieves the double buffering value.
 int getGreenSize()
          Retrieves the number of green bits requested by this template.
 int getRedSize()
          Retrieves the number of red bits requested by this template.
 int getSceneAntialiasing()
          Retrieves the scene antialiasing value.
 int getStencilSize()
          Retrieves the size of the stencil buffer.
 int getStereo()
          Retrieves the stereo value.
 boolean isGraphicsConfigSupported(java.awt.GraphicsConfiguration gc)
          Returns a boolean indicating whether or not the given GraphicsConfiguration can be used to create a drawing surface that can be rendered to.
 void setBlueSize(int value)
          Sets the number of blue bits required.
 void setDepthSize(int value)
          Sets the depth buffer size requirement.
 void setDoubleBuffer(int value)
          Sets the double buffering requirement.
 void setGreenSize(int value)
          Sets the number of green bits required.
 void setRedSize(int value)
          Sets the number of red bits required.
 void setSceneAntialiasing(int value)
          Sets the scene antialiasing requirement.
 void setStencilSize(int value)
          Sets the stencil buffer size requirement.
 void setStereo(int value)
          Sets the stereo requirement.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphicsConfigTemplate3D

public GraphicsConfigTemplate3D()
Constructs a GraphicsConfigTemplate3D object with default parameters. The default values are as follows:

Method Detail

setDoubleBuffer

public void setDoubleBuffer(int value)
Sets the double buffering requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of double buffering is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getDoubleBuffer

public int getDoubleBuffer()
Retrieves the double buffering value.

Returns:
the current value of the doubleBuffer attribute

setStereo

public void setStereo(int value)
Sets the stereo requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of stereo requirement is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getStereo

public int getStereo()
Retrieves the stereo value.

Returns:
the current value of the stereo attribute.

setSceneAntialiasing

public void setSceneAntialiasing(int value)
Sets the scene antialiasing requirement. It should be GraphicsConfigTemplate.REQUIRED, GraphicsConfigTemplate.PREFERRED, or GraphicsConfigTemplate.UNNECESSARY. If an invalid value is passed in, it is ignored. If the value of scene antialiasing is GraphicsConfigTemplate.REQUIRED, and no GraphicsConfiguration is found that meets this requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getSceneAntialiasing

public int getSceneAntialiasing()
Retrieves the scene antialiasing value.

Returns:
the current value of the scene antialiasing attribute.

setDepthSize

public void setDepthSize(int value)
Sets the depth buffer size requirement. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getDepthSize

public int getDepthSize()
Retrieves the size of the depth buffer.

Returns:
the current value of the depthSize attribute

setStencilSize

public void setStencilSize(int value)
Sets the stencil buffer size requirement. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to
Since:
Java 3D 1.4

getStencilSize

public int getStencilSize()
Retrieves the size of the stencil buffer.

Returns:
the current value of the stencilSize attribute
Since:
Java 3D 1.4

setRedSize

public void setRedSize(int value)
Sets the number of red bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getRedSize

public int getRedSize()
Retrieves the number of red bits requested by this template.

Returns:
the current value of the redSize attribute.

setGreenSize

public void setGreenSize(int value)
Sets the number of green bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getGreenSize

public int getGreenSize()
Retrieves the number of green bits requested by this template.

Returns:
the current value of the greenSize attribute.

setBlueSize

public void setBlueSize(int value)
Sets the number of blue bits required. This is the minimum requirement. If no GraphicsConfiguration is found that meets or exceeds this minimum requirement, null will be returned in getBestConfiguration().

Parameters:
value - the value to set this field to

getBlueSize

public int getBlueSize()
Retrieves the number of blue bits requested by this template.

Returns:
the current value of the blueSize attribute.

getBestConfiguration

public java.awt.GraphicsConfiguration getBestConfiguration(java.awt.GraphicsConfiguration[] gc)
Implement the abstract function of getBestConfiguration() in GraphicsConfigTemplate. Usually this function is not directly called by the user. It is implicitly called by getBestConfiguration() in GraphicsDevice. The method getBestConfiguration() in GraphicsDevice will return whatever this function returns. This function will return the "best" GraphicsConfiguration. The "best" GraphicsConfiguration means that this GraphicsConfiguration is supported and it meets or exceeds what was requested in the GraphicsConfigTemplate. If no such "best" GraphicsConfiguration is found, null is returned.

Specified by:
getBestConfiguration in class java.awt.GraphicsConfigTemplate
Parameters:
gc - the array of GraphicsConfigurations to choose from
Returns:
the best GraphicsConfiguration
See Also:
GraphicsDevice

isGraphicsConfigSupported

public boolean isGraphicsConfigSupported(java.awt.GraphicsConfiguration gc)
Returns a boolean indicating whether or not the given GraphicsConfiguration can be used to create a drawing surface that can be rendered to.

Specified by:
isGraphicsConfigSupported in class java.awt.GraphicsConfigTemplate
Parameters:
gc - the GraphicsConfiguration object to test
Returns:
true if this GraphicsConfiguration object can be used to create surfaces that can be rendered to, false if the GraphicsConfiguration can not be used to create a drawing surface usable by this API.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.


Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.