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.
-
alts
- An array with the alt textfields
-
answerLabels
- An array with the labels
-
Group1
- The CheckboxGroup used to make the checkbox work like radiobuttons
-
noOfAlts
- The number of alternatives.
-
radios
- An array with the checkboxes
-
AltPanel()
-
-
addNotify()
- Creates and puts all the textfield on the Panel
-
getAnswerText()
-
-
getCorrectAnswer()
-
-
getType()
-
-
isTextFilled()
-
-
setCorrect(int)
- Sets the correct checkbox
-
setError(int, int)
- Makes the background of the checkboxes red.
-
setQuestion(String, String[], int, int)
- Fills the fields and marks the correct checkbox
-
setReadEnabled()
- Sets if the Alt question could be edited or no.
noOfAlts
static final int noOfAlts
- The number of alternatives.
radios
private Checkbox radios[]
- An array with the checkboxes
alts
private TextField alts[]
- An array with the alt textfields
answerLabels
private Label answerLabels[]
- An array with the labels
Group1
private CheckboxGroup Group1
- The CheckboxGroup used to make the checkbox work like radiobuttons
AltPanel
public AltPanel()
getCorrectAnswer
public Integer getCorrectAnswer()
- Returns:
- the number of the checkbox currently selected 0-4
- Overrides:
- getCorrectAnswer in class QuestionPanel
getAnswerText
public String[] getAnswerText()
- Returns:
- a String array with all the alternative texts
getType
public int getType()
- Returns:
- the type of the QuetsionPanel
- Overrides:
- getType in class QuestionPanel
isTextFilled
public boolean isTextFilled()
- Returns:
- true if the question field and one of the alternative fields have text.
- Overrides:
- isTextFilled in class QuestionPanel
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.
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
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
setCorrect
private void setCorrect(int correct)
- Sets the correct checkbox
- Parameters:
- correct - the number of the correct alternative
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