All Packages Class Hierarchy This Package Previous Next Index
Class distans.CrossPanel
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----distans.QuestionPanel
|
+----distans.CrossPanel
- public class CrossPanel
- extends QuestionPanel
- implements KeyListener
This class is responsible for graphically displaying a subquestion for Pages of type Cross.
Each subquestion conatins of a questio text field an answer text field and a textfield for the correct answer
When used by the ReadAnswer Applet teh correctAnswer field is used to display the grade the teatcher has given
the answer. This however is not of much use in the current version as the grades never can be saved on the server.
-
answer
-
-
answerLabel
-
-
correctAnswer
-
-
next
- A reference to the next CrossPanel used for tabbing between CrossPanels
-
CrossPanel()
- Creates the Cross panel and adds the graphical components
-
addNotify()
-
-
getAnswerText()
-
-
getCorrectAnswer()
-
-
getGrade()
-
-
getType()
-
-
isTextFilled()
-
-
keyPressed(KeyEvent)
- If the answer field is the source and the button pressed is tab, this method will
move the focus to the next crossPanel.
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
processFocusEvent(FocusEvent)
- Sets the focus to the question field when the CrossPanel gets focus
-
setNext(CrossPanel)
- Sets the crossPanel with the next question.
-
setQuestion(String, String, int, int)
- Sets the text in the text fields
-
setQuestion(String, String[], int, int)
- Sets the text in the text fields
-
setReadEnabled()
- Makes the text field non editable, used by the ReadAnswerApplet
next
private CrossPanel next
- A reference to the next CrossPanel used for tabbing between CrossPanels
answerLabel
Label answerLabel
answer
TextField answer
correctAnswer
TextField correctAnswer
CrossPanel
public CrossPanel()
- Creates the Cross panel and adds the graphical components
setReadEnabled
public void setReadEnabled()
- Makes the text field non editable, used by the ReadAnswerApplet
setQuestion
public void setQuestion(String qText,
String aText,
int correct,
int qNo)
- Sets the text in the text fields
- Parameters:
- qText - the question text
- aText - the answer text
- correct - the number of the answer
- the - question no
setQuestion
public void setQuestion(String qText,
String aText[],
int correct,
int qNo)
- Sets the text in the text fields
- Parameters:
- qText - the question text
- aText - the answer text
- correct - the number of the answer
- the - question no
setNext
public void setNext(CrossPanel cp)
- Sets the crossPanel with the next question.
- Parameters:
- cp - the next crossPanel
processFocusEvent
protected void processFocusEvent(FocusEvent e)
- Sets the focus to the question field when the CrossPanel gets focus
- Overrides:
- processFocusEvent in class Component
isTextFilled
public boolean isTextFilled()
- Returns:
- trueu if the question and answer field is filled.
- Overrides:
- isTextFilled in class QuestionPanel
getType
public int getType()
- Returns:
- always returns PageData.CROSS
- Overrides:
- getType in class QuestionPanel
getCorrectAnswer
public Integer getCorrectAnswer()
- Returns:
- the answer given in the correctAnswer field. If the answer can't be parsed into a number
0 is returned
- Overrides:
- getCorrectAnswer in class QuestionPanel
getAnswerText
public String[] getAnswerText()
- Returns:
- s the answer in the answer field, to be compatible with the same methid in altPanel an array is returned.
getGrade
public int getGrade()
- Returns:
- the answer given in the correctAnswer field. If the answer can't be parsed into a number
-1 is returned
addNotify
public void addNotify()
- Overrides:
- addNotify in class Panel
keyTyped
public void keyTyped(KeyEvent e)
keyReleased
public void keyReleased(KeyEvent e)
keyPressed
public void keyPressed(KeyEvent e)
- If the answer field is the source and the button pressed is tab, this method will
move the focus to the next crossPanel. Unfortunatley this method don't work on some browsers.
All Packages Class Hierarchy This Package Previous Next Index