All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class distans.AltPanel

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----distans.QuestionPanel
                                   |
                                   +----distans.AltPanel

public class AltPanel
extends QuestionPanel
This class is responsible for graphically displaying one sub question in a page of type Alt. A subquestion is made of 5 pairs of alternative textfield and checkboxes. The text field is in the super class. There are also 5 lables displaying the number of the alternative.


Variable Index

 o alts
An array with the alt textfields
 o answerLabels
An array with the labels
 o Group1
The CheckboxGroup used to make the checkbox work like radiobuttons
 o noOfAlts
The number of alternatives.
 o radios
An array with the checkboxes

Constructor Index

 o AltPanel()

Method Index

 o addNotify()
Creates and puts all the textfield on the Panel
 o getAnswerText()
 o getCorrectAnswer()
 o getType()
 o isTextFilled()
 o setCorrect(int)
Sets the correct checkbox
 o setError(int, int)
Makes the background of the checkboxes red.
 o setQuestion(String, String[], int, int)
Fills the fields and marks the correct checkbox
 o setReadEnabled()
Sets if the Alt question could be edited or no.

Variables

 o noOfAlts
 static final int noOfAlts
The number of alternatives.

 o radios
 private Checkbox radios[]
An array with the checkboxes

 o alts
 private TextField alts[]
An array with the alt textfields

 o answerLabels
 private Label answerLabels[]
An array with the labels

 o Group1
 private CheckboxGroup Group1
The CheckboxGroup used to make the checkbox work like radiobuttons

Constructors

 o AltPanel
 public AltPanel()

Methods

 o getCorrectAnswer
 public Integer getCorrectAnswer()
Returns:
the number of the checkbox currently selected 0-4
Overrides:
getCorrectAnswer in class QuestionPanel
 o getAnswerText
 public String[] getAnswerText()
Returns:
a String array with all the alternative texts
 o getType
 public int getType()
Returns:
the type of the QuetsionPanel
Overrides:
getType in class QuestionPanel
 o isTextFilled
 public boolean isTextFilled()
Returns:
true if the question field and one of the alternative fields have text.
Overrides:
isTextFilled in class QuestionPanel
 o setReadEnabled
 public void setReadEnabled()
Sets if the Alt question could be edited or no. In the ReadAnswer Applet the user can't edit the textfields and the checkboxes.

 o setQuestion
 public void setQuestion(String qText,
                         String aText[],
                         int correct,
                         int qNo)
Fills the fields and marks the correct checkbox

Parameters:
qText - the question text
aText - the alternatives
correct - the number of the correct alternative 0-4
qNo - the number of the question
 o setError
 void setError(int answer,
               int correct)
Makes the background of the checkboxes red. This is used by the ReadAnswer Applet to mark questions wrongly answered by the student

Parameters:
answer - the student answer
correct - the correct answer
 o setCorrect
 private void setCorrect(int correct)
Sets the correct checkbox

Parameters:
correct - the number of the correct alternative
 o addNotify
 public void addNotify()
Creates and puts all the textfield on the Panel

Overrides:
addNotify in class Panel

All Packages  Class Hierarchy  This Package  Previous  Next  Index