annotate EndBlockPanel.java @ 52:76e99859bdb4 tip

Add class files for previous changes.
author Marcus Pearce <marcus.pearce@eecs.qmul.ac.uk>
date Wed, 25 Feb 2015 10:11:04 +0000
parents be66ee2fe9fe
children
rev   line source
c@47 1 /*=============================================================================
c@47 2 * File: EndBlockPanel.java
c@47 3 * Author: Carl Bussey <c.bussey@se10.qmul.ac.uk>
c@47 4 * Created: <2013-06-13 17:32>
c@47 5 *=============================================================================
c@47 6 */
c@47 7
c@47 8 import java.awt.*;
c@47 9 import java.awt.event.*;
c@47 10 import javax.swing.*;
c@47 11
c@47 12 abstract class EndBlockPanel extends JPanel {
c@47 13
c@47 14 /* variables */
c@47 15 protected JButton continueButton;
c@47 16 protected String continueButtonText;
c@47 17 protected JLabel message;
c@47 18 protected Experiment exp;
c@47 19 protected StringBuffer sb;
c@47 20
c@47 21 /* accessors */
c@47 22 public JButton getContinueButton() { return continueButton; }
c@47 23
c@47 24 /* constructor */
c@47 25 public EndBlockPanel(Experiment e) {
c@47 26 exp = e;
c@47 27 sb = new StringBuffer();
c@47 28 }
c@47 29
c@47 30 public void updateMessageDisplay() {
c@47 31 message.setText(formatMessage());
c@47 32 }
c@47 33
c@47 34 abstract protected String formatMessage();
c@47 35
c@47 36 public void addContinueButtonListener(ActionListener al) {
c@47 37 continueButton.addActionListener(al);
c@47 38 }
c@47 39
c@47 40 public void setUp(String buttonText){
c@47 41 continueButton = new JButton(buttonText);
c@47 42 JPanel continuePane = new JPanel();
c@47 43 continuePane.add(continueButton);
c@47 44
c@47 45 message = new JLabel();
c@47 46 message.setHorizontalAlignment(JLabel.CENTER);
c@47 47 updateMessageDisplay();
c@47 48 JPanel messagePane = new JPanel(new FlowLayout(FlowLayout.CENTER));
c@47 49 messagePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
c@47 50 messagePane.add(message);
c@47 51
c@47 52 this.setLayout(new BorderLayout());
c@47 53 this.add(messagePane, BorderLayout.CENTER);
c@47 54 this.add(continuePane, BorderLayout.SOUTH);
c@47 55 }
c@47 56
c@47 57 }