/** @author Scott Marshall @author University of Glasgow, MSc IT Project 2001 @author Building an OnLine Course in Computing Fundamentals Multiple Choice Questions */ package ukacgla_HTMLMulti; import ukacgla_HTMLMulti.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; import java.util.*; import java.net.*; /** TestLine holds the details of a single line in the test. It holds any image icons to be displayed, the text needed to complete the HTML to be displayed on labels, the URL of the follow up file, and whether this line is a correct solution or not. */ public class TestLine{ private ImageIcon icon; private String initialText; private URL followOnURL; private boolean correct; // True if this line is correct answer to the question /** Constructor takes all the arguments needed to generate a single option to be presented to user. Image icon is any images to be displayed. The String will be formatted for presentation as HTML, and will be the text presented to the . The URL is the URL of the follow on information to be displayed after student has made their selection The int must be 1 is this is the correct answer to the question, otherwise must be 0. */ public TestLine(ImageIcon icon, String text, URL followOnURL, int c){ this.icon = icon; this.followOnURL = followOnURL; if (c==1) correct = true; else correct = false; //used to complete the HTML for display on a label initialText = "\n" + "\n"+ "\n" + text+"\n"+ "\n" + "\n"; } protected ImageIcon getIcon() { return icon; } protected String getText(){ return initialText; } protected URL getFollowOnURL(){ return followOnURL; } protected boolean getCorrect(){ return correct; } }