c@47: /*============================================================================= c@47: * File: EndBlockPanel.java c@47: * Author: Carl Bussey c@47: * Created: <2013-06-13 17:32> c@47: *============================================================================= c@47: */ c@47: c@47: import java.awt.*; c@47: import java.awt.event.*; c@47: import javax.swing.*; c@47: c@47: abstract class EndBlockPanel extends JPanel { c@47: c@47: /* variables */ c@47: protected JButton continueButton; c@47: protected String continueButtonText; c@47: protected JLabel message; c@47: protected Experiment exp; c@47: protected StringBuffer sb; c@47: c@47: /* accessors */ c@47: public JButton getContinueButton() { return continueButton; } c@47: c@47: /* constructor */ c@47: public EndBlockPanel(Experiment e) { c@47: exp = e; c@47: sb = new StringBuffer(); c@47: } c@47: c@47: public void updateMessageDisplay() { c@47: message.setText(formatMessage()); c@47: } c@47: c@47: abstract protected String formatMessage(); c@47: c@47: public void addContinueButtonListener(ActionListener al) { c@47: continueButton.addActionListener(al); c@47: } c@47: c@47: public void setUp(String buttonText){ c@47: continueButton = new JButton(buttonText); c@47: JPanel continuePane = new JPanel(); c@47: continuePane.add(continueButton); c@47: c@47: message = new JLabel(); c@47: message.setHorizontalAlignment(JLabel.CENTER); c@47: updateMessageDisplay(); c@47: JPanel messagePane = new JPanel(new FlowLayout(FlowLayout.CENTER)); c@47: messagePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); c@47: messagePane.add(message); c@47: c@47: this.setLayout(new BorderLayout()); c@47: this.add(messagePane, BorderLayout.CENTER); c@47: this.add(continuePane, BorderLayout.SOUTH); c@47: } c@47: c@47: }