Preferences Class

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 Microsoft® 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 Methods

getBoolean Returns the value of those preferences that are set by Booleans.
getDouble Returns the value of those preferences that are set by a double.
getInt Returns the value of those preferences that are set by an integer.
getString Returns the value of those preferences that are set by a string.
Preferences Constructs a Preferences object.
propagate Tells the system to use the new preferences.
set(preference, Boolean) Sets the value of those preferences that are determined by booleans.
set(preference, double) Sets the value of those preferences that are determined by doubles.
set(preference, int) Sets the value of those preferences that are determined by integers.
set(preference, String) Sets the value of those preferences that are determined by strings.

getBoolean

Preferences Class

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

Syntax

public Boolean getBoolean( String preference );

Parameters

preference
The name of the preference.

Return Value

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.

Syntax

public double getDouble( String preference );

Parameters

preference
The name of the preference.

Return Value

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.

Syntax

public int getInt( String preference );

Parameters

preference
The name of the preference.

Return Value

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

getString

Preferences Class

Returns the name of a preference.

Syntax

public String getString( String preference );

Parameters

preference
The name of the preference.

Return Value

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

Preferences Constructor

Preferences Class

Constructs a Preferences object.

Syntax

public Preferences( );

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.

Syntax

public void propagate( );

set(preference, Boolean)

Preferences Class

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

Syntax

public void set( String preference, Boolean value );

Parameters

preference
Name of the preference.
value
Value of the preference.

set(preference, double)

Preferences Class

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

Syntax

public void set( String preference, double value );

Parameters

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

set(preference, int)

Preferences Class

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

Syntax

public void set( String preference, int value );

Parameters

preference
Name of the preference.
value
Value of the preference.

set(preference, String)

Preferences Class

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

Syntax

public void set( String preference, String value );

Parameters

preference
Name of the preference.
value
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 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.

Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.