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.


Variable Index

 o answer
 o answerLabel
 o correctAnswer
 o next
A reference to the next CrossPanel used for tabbing between CrossPanels

Constructor Index

 o CrossPanel()
Creates the Cross panel and adds the graphical components

Method Index

 o addNotify()
 o getAnswerText()
 o getCorrectAnswer()
 o getGrade()
 o getType()
 o isTextFilled()
 o 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.
 o keyReleased(KeyEvent)
 o keyTyped(KeyEvent)
 o processFocusEvent(FocusEvent)
Sets the focus to the question field when the CrossPanel gets focus
 o setNext(CrossPanel)
Sets the crossPanel with the next question.
 o setQuestion(String, String, int, int)
Sets the text in the text fields
 o setQuestion(String, String[], int, int)
Sets the text in the text fields
 o setReadEnabled()
Makes the text field non editable, used by the ReadAnswerApplet

Variables

 o next
 private CrossPanel next
A reference to the next CrossPanel used for tabbing between CrossPanels

 o answerLabel
 Label answerLabel
 o answer
 TextField answer
 o correctAnswer
 TextField correctAnswer

Constructors

 o CrossPanel
 public CrossPanel()
Creates the Cross panel and adds the graphical components

Methods

 o setReadEnabled
 public void setReadEnabled()
Makes the text field non editable, used by the ReadAnswerApplet

 o 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
 o 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
 o setNext
 public void setNext(CrossPanel cp)
Sets the crossPanel with the next question.

Parameters:
cp - the next crossPanel
 o processFocusEvent
 protected void processFocusEvent(FocusEvent e)
Sets the focus to the question field when the CrossPanel gets focus

Overrides:
processFocusEvent in class Component
 o isTextFilled
 public boolean isTextFilled()
Returns:
trueu if the question and answer field is filled.
Overrides:
isTextFilled in class QuestionPanel
 o getType
 public int getType()
Returns:
always returns PageData.CROSS
Overrides:
getType in class QuestionPanel
 o 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
 o 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.
 o 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
 o addNotify
 public void addNotify()
Overrides:
addNotify in class Panel
 o keyTyped
 public void keyTyped(KeyEvent e)
 o keyReleased
 public void keyReleased(KeyEvent e)
 o 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