view InterBlockPanel.java @ 47:be66ee2fe9fe

Added abstract class EndBlockPanel to deliver end of block messages (e.g. end of practice block). Added and implemented EndTestPanel which gives "thank you for participating" etc message at end of test.
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Thu, 13 Jun 2013 18:33:34 +0100
parents 4031cbb02f08
children
line wrap: on
line source
/*=============================================================================
 * File:       InterBlockPanel.java
 * Author:     Marcus Pearce <m.pearce@gold.ac.uk>
 * Created:    <2008-01-08 15:39:18 marcusp>
 * Time-stamp: <2008-03-04 17:16:48 marcusp>
 *=============================================================================
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class InterBlockPanel extends EndBlockPanel {
    
    /* variables */ 
    private String previousText; 
    private String text = ""; 

    /* accessors */ 
    public void setText() { 
        previousText = text; 
        text = exp.getCurrentBlock().getLabel(); 
    }

    /* constructor */ 
    public InterBlockPanel(Experiment e) { 
        super(e);
        setText();
        setUp("Continue");
    }
    
    protected String formatMessage() {
        StringBuffer sb = new StringBuffer();
        sb.append("<html><font size=\"+1\" face=\"sans\"><p align=center>");
        sb.append("That is the end of the ");
        sb.append(previousText); 
        sb.append(" block. "); 
        sb.append("<br>");
        sb.append("If you have any questions, you may ask them now."); 
        sb.append("<br>"); 
        sb.append("Otherwise, press the button below to continue on to the ");
        sb.append(text);
        sb.append(" block."); 
        sb.append("</p></html>");

        return sb.toString();
    }
}