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.
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.
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.
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.
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.
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.
Constructs a Preferences object.
Syntax
public Preferences( );
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( );
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.
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.
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.
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.
Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.