DirectAnimation Animated Header --Preferences Class DirectAnimation Animated Header --Preferences Class* Microsoft DirectAnimation SDK
*Index  *Topic Contents
*Previous Topic: Point3Bvr Class
*Next Topic: PropertyDispatcher Class

Preferences Class


public class Preferences extends java.lang.Object{

    // Fields
    public final static String COLOR_KEY_BLUE;
    public final static String COLOR_KEY_GREEN;
    public final static String COLOR_KEY_RED;
    public final static String DITHERING;
    public final static String ENGINE_OPTIMIZATIONS;
    public final static String FILL_MODE;
    public final static int    FILL_MODE_POINT;
    public final static int    FILL_MODE_SOLID;
    public final static int    FILL_MODE_WIREFRAME;
    public final static String MAX_FRAMES_PER_SEC;
    public final static String OVERRIDE_APPLICATION_PREFERENCES;
    public final static String PERSPECTIVE_CORRECT;
    public final static String RGB_LIGHTING_MODE;
    public final static String SHADE_MODE;
    public final static int    SHADE_MODE_FLAT;
    public final static int    SHADE_MODE_GOURAUD;
    public final static int    SHADE_MODE_PHONG;
    public final static String TEXTURE_QUALITY;
    public final static int    TEXTURE_QUALITY_LINEAR;
    public final static int    TEXTURE_QUALITY_NEAREST;
    public final static String USE_VIDEOMEM;
    public final static String USE_3-D_HW;
     
    // Constructor
    public Preferences();

   // Methods
   public boolean getBoolean(String preference);
   public double getDouble(String preference);
   public int getInt(String preference);
   public String getString(String preference);
   public void propagate();
   public void set(String preference, boolean value);
   public void set(String preference, double value);
   public void set(String preference, int value);
   public void set(String preference, String value);
}

A Preferences object controls various model qualities (such as texturing and shading) and hardware preferences. The object contains methods both for setting and retrieving these values. Each preference is identified with a string and its value is set by either a boolean, an integer, or a double. Before getting or setting a preference, first obtain the Preference object with the Viewer.getPreferences method.

The first time DirectAnimation is run, it establishes the default preferences in the registry. This means the end-user can control what the default preference settings are. When the Viewer.getPreferences method is invoked, the Preferences object contains these settings. These settings can be overridden by calling the set() methods on the Preferences object.

A preference called OVERRIDE_APPLICATION_PREFERENCES allows the end-user to decide if a canvas or applet can override the other preferences. If it is TRUE, then explicitly setting the Preferences object will have no effect.


Preferences Constructor

Preferences Class

Constructs an Preferences object.

public Preferences( );



Preferences Methods

getBoolean
getDouble
getInt
getString
propagate
set(preference, boolean)
set(preference, double)
set(preference, int)
set(preference, string)


getBoolean

Preferences Class

Returns the value of those preferences that are set by booleans.

public boolean getBoolean(
  String preference
  );

Parameters
preference
The name of the preference.
Return Values

Returns a boolean. For more information about booleans, consult a Java reference.


getDouble

Preferences Class

Returns the value of those preferences that are set by a double.

public double getDouble(
  String preference
  );

Parameters
preference
The name of the preference.
Return Values

Returns a double. For more information about doubles, consult a Java reference.


getInt

Preferences Class

Returns the value of those preferences that are set by an integer.

public int getInt(
  String preference
  );

Parameters
preference
The name of the preference.
Return Values

Returns an integer. For more information about integers, consult a Java reference.


getString

Preferences Class

Returns the name of a preference.

public String getString(
  String preference
  );

Parameters
preference
The name of the preference.
Return Values

Returns the value of those preferences that are set by a string. For more information about strings, consult a Java reference.


propagate

Preferences Class

Tells the system to use the new preferences. Use after calling Viewer.getPreferences and the Preference.set() methods but before the model is running.

public void propagate( );


set

Preferences Class

Sets the value of those preferences that are determined by booleans.

public void set(
  String preference,
  boolean value
  );

Parameters
preference
The name of the preference.
value
The value of the preference.


set

Preferences Class

Sets the value of those preferences that are determined by doubles.

public void set(
  String preference,
  double value
  );

Parameters
preference
The name of the preference.
value
The value of the preference.


set

Preferences Class

Sets the value of those preferences that are determined by integers.

public void set(
  String preference,
  int value
  );

Parameters
preference
The name of the preference.
value
The value of the preference.


set

Preferences Class

Sets the value of those preferences that are determined by strings.

public void set(
  String preference,
  String value
  );

Parameters
preference
The name of the preference.
value
The value of the preference.

Preferences Fields

public final static String COLOR_KEY_BLUE
Determines the value of the blue RGB component. The value is set by an integer that can range from 0 to 255. The default value is 245.
public final static String COLOR_KEY_GREEN
Determines the value of the green RGB component. The value is set by an integer that can range from 0 to 255. The default value is 254.
public final static String COLOR_KEY_RED
Determines the value of the red RGB component. The value is set by an integer that can range from 0 to 255. The default value is 1.
public final static String DITHERING
Determines whether or not dithering is enabled. The value is set by a boolean. The default mode is Enabled.
public final static String ENGINE_OPTIMIZATIONS
Determines whether or not there will be optimizations. Optimizations include such things as image caching and dirty rectangle optimization. The value is set by a boolean. The default value is On.
public final static String FILL_MODE
Determines the fill mode, which can be FILL_MODE_POINT, FILL_MODE_SOLID, or FILL_MODE_WIREFRAME. The value is set by an integer. The default mode is Solid.
public final static int FILL_MODE_POINT
Sets the fill mode to point.
public final static int FILL_MODE_SOLID
Sets the fill mode to solid. This is the default mode.
public final static int FILL_MODE_WIREFRAME
Sets the fill mode to wireframe.
public final static String OVERRIDE_APPLICATION_PREFERENCES
A boolean value that, if true, means the registry overrides any attempts by the application to set preferences. This value cannot be set. It can only be retrieved with getBoolean. The default value is Off.
public final static String PERSPECTIVE_CORRECT
Determines whether or not texturing will be adjusted for perspective. The value is set by a boolean. The default mode is On.
public final static MAX_FRAMES_PER_SEC
Determines the maximum number of frames per second. The value is set by a double. The default value is 30.
public final static String RGB_LIGHTING_MODE
Determines whether or not the lighting mode is RGB. The value is set by a boolean. The default value is On.
public final static String SHADE_MODE
Determines what the shading mode will be. The possibilities are SHADE_MODE_FLAT, SHADE_MODE_GOURAUD, or SHADE_MODE_PHONG. The value is set by an integer. The default mode is GOURAUD.
public final static SHADE_MODE_FLAT
Sets the shading mode to flat.
public final static int SHADE_MODE_GOURAUD
Sets the shading mode to Gouraud. This is the default mode.
public final static int SHADE_MODE_PHONG
Sets the shading mode to Phong.
public final static String TEXTURE_QUALITY
Determines what the texture rendering quality will be. The possibilities are TEXTURE_QUALITY_LINEAR or TEXTURE_QUALITY_NEAREST. The value is set by an integer. The default mode is NEAREST.
public final static int TEXTURE_QUALITY_LINEAR
Sets the texture rendering quality to linear.
public final static int TEXTURE_QUALITY_NEAREST
Sets the texture rendering quality to nearest. This is the default mode.
public final static String USE_3-D_HW
Determines whether or not 3-D hardware will be enabled. The value is set by a boolean. The default is Off. This preference cannot be overridden by the application. It is a read-only value.
public final static USE_VIDEOMEM
Determines whether or not the video memory will be enabled. The value is set by a boolean. The default is On.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page