package jsmith.eval12; import java.awt.*; import javax.swing.*; import javax.swing.JApplet.*; import java.util.*; import java.awt.event.*; public class EvaluationApplet extends JApplet implements ActionListener{ JButton button1 = null; Vector answerChoices = null; Vector actualAnswers = null; Vector[] answers = new Vector[100]; EvaluationFrame evalFrame = null; public void init(){ button1 = new JButton("Answer this question."); answerChoices = new Vector(); actualAnswers = new Vector(); for(int i = 0; i < 100; ++i){ answers[i] = new Vector(); } this.getContentPane().add(button1); button1.addActionListener(this); answerChoices = new Vector(); String[] ansChoices = { "The spark in the cabin.", "The pressure of the oxygen (17 lbs).", "The current in the wire.", "The velcro in the cabin.", "None of the above." }; for(int i = 0; i < 5; ++i){ answerChoices.addElement(ansChoices[i]); } String[] ans1String = { "The spark in the cabin." }; String[] ans2String = { "The pressure of the oxygen (17 lbs)." }; String[] ans3String = { "The current in the wire." }; String[] ans4String = { "The velcro in the cabin." }; for(int i = 0; i < 1; ++i){ answers[0].addElement(ans1String[i]); } for(int i = 0; i < 1; ++i){ answers[1].addElement(ans2String[i]); } for(int i = 0; i < 1; ++i){ answers[2].addElement(ans3String[i]); } for(int i = 0; i < 1; ++i){ answers[3].addElement(ans4String[i]); } actualAnswers.addElement(answers[0]); actualAnswers.addElement(answers[1]); actualAnswers.addElement(answers[2]); actualAnswers.addElement(answers[3]); } public void actionPerformed(ActionEvent evt){ if(evalFrame == null){ evalFrame = new EvaluationFrame(answerChoices, actualAnswers); evalFrame.setSize(800,400); } evalFrame.setVisible(true); } }