GradeBar

The GradeBar is used to give a grade as an answer to a question. The scale that is used can be specified with any limits and number of decimals. Adjectives may be associated with certain ranges of values.

Here is an example of a grade bar with range from 0.0 to 10.0 with one decimal and adjectives:

[image of a GradeBar]

Here is a list of parameters available for a grade bar:

Parameter Value Description R/O
class GradeBar Class alias for a grade bar component. Req.
question text The question shown to subject. Req.
minimum number The minimum of the scale. Default is 0.0. Opt.
maximum number The maximum of the scale. Default is 5.0. Opt.
decimals number of decimals Number of decimals in the grade. Default is 1. Opt.
questionfont font name The font used for question text. Opt.
showValue true or false Whether to show the current value to the subject. Default is true. Opt.
showLabels true or false Whether to show the adjectives to the subject. Default is true. Opt.
choiceformat choice format string Give adjectives to certain ranges of values. Default is no adjectives, only the value is shown. Opt.
defaultAnswer number Set the initial value (and the position) of the grade bar when the question is initialized or reset. A special value 'random' can be used to initialize the value with a new random number every time the component is reset. If this option is left out, the default answer is the midpoint of the minimum and maximum of the scale. Opt.

Question

The question parameter is used to set the question that is shown to the subject. Example:
   # Set question text
   qA.question=Clarity of sample A

The scale of the grade

The range of grades that the subject can give is specified with the minimum, maximum and decimals parameters. Both minimum and maximum can be either positive or negative but minimum should be less than the maximum. If integer answer values are wanted, set decimals to zero.

The following example sets the scale to from 0 to 10 with one decimals. The question name will be 'qA':

   # Set range of grade to [0.0, 10.0] (one decimal).
   qA.minimum=0.0
   qA.maximum=10.0
   qA.decimals=1

Question font

The font used to display the text of question can be set with the questionfont parameter. It takes a valid Java font specification as a value. For example:
   # The font of the question
   qA.questionfont=Serif-italic-24
You can use the FontTester tool help you select the fonts you want. See also the API of the Java's Font class.

Show value to subject?

By default the value of the grade bar is shown to the subject as he/she moves the scrollbar. Set the showValue parameter to false to not show the value to the subject. Example:
   # Do not show grade to subject
   qA.showValue=false
If showValue is set to false, only the adjectives (see below) will be shown if they are set.

Associate adjectives to range of values

Adjectives can be associated with ranges of values. It is done by setting the choiceformat parameter. More information about the choice format can be found in the Java's ChoiceFormat API. The following example should help you to make your own choiceformats:
   # Set adjectives
   qA.choiceformat=0.0#Very unclear|2.0#Rather unclear|4.0#Midway|6.0#Rather clear|8.0#Very Clear
This string tells that the adjective 'Very unclear' will be shown if the value X is between 0.0 and 2.0 (0.0 <= X < 2.0), 'Rather Unclear' will be shown if 2.0 <= X < 4.0, and so on. If X < 0.0 the first adjective will be shown and if X > 8.0 the last adjective is shown.

For adjectives to be shown, the showLabels parameter must be set to true (it is true by default).

Default/initial answer

By default the grade bar's knob is set to the middle of the minimum and maximum of the range when the component is reset. Also a fixed or random value can be used. To use a fixed value as the initial answer or the position of the knob, set the defaultAnswer parameter to desired value. For example, to use value 1.5 as initial value:
   # Use initial value 1.5
   qA.defaultAnswer=1.5
The position of the knob is set to the position that matches that value on the range.

To automatically generate a random initial value when the component is reset, set defaultAnswer to string 'random':

   # Use random values for initial value
   qA.defaultAnswer=random
It generates a new random value between the minimum and maximum of the grade bar's range.

It is also possible to limit the range of the initial random value to a smaller range than minimum and maximum of the component. Use the defaultAnswer.randomMin and defaultAnswer.randomMax parameters to set different limits. For example (lets assume the component's answer value range is [0.0, 10.0]):

   # Use random initial values with values between [3.0, 7.0] 
   qA.defaultAnswer=random
   qA.defaultAnswer.randomMin=3.0
   qA.defaultAnswer.randomMax=7.0

· UI index · Document index ·

Last modified: Wed Dec 22 13:49:10 EET 1999