Mercurial > hg > mep
view InterBlockPanel.java @ 39:796b3e3e053f
Changed MidiPlayer.java to allow the use of external sequencer programs (e.g. Garageband).
Changed Experiment.java to allow user to specify in commandline whether to use default MidiDevice (true), specified MidiDevice (0<variable<MidiDevs.length), or list the available devices on start up.
Changed ExperimentGui.java and SubjectDataPanel.java to add familiarity question if familiarity question isn't included at the presentation of each stimuli.
author | CBussey |
---|---|
date | Fri, 31 May 2013 17:40:59 +0100 |
parents | 4031cbb02f08 |
children | be66ee2fe9fe |
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 JPanel { /* variables */ private JButton continueButton; private JLabel message; private String previousText; private String text = ""; private Experiment exp; /* accessors */ public JButton getContinueButton() { return continueButton; } public void setText() { previousText = text; text = exp.getCurrentBlock().getLabel(); } /* constructor */ public InterBlockPanel(Experiment e) { exp = e; setText(); continueButton = new JButton("Continue"); JPanel continuePane = new JPanel(); continuePane.add(continueButton); message = new JLabel(); message.setHorizontalAlignment(JLabel.CENTER); updateMessageDisplay(); JPanel messagePane = new JPanel(new FlowLayout(FlowLayout.CENTER)); messagePane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); messagePane.add(message); this.setLayout(new BorderLayout()); this.add(messagePane, BorderLayout.CENTER); this.add(continuePane, BorderLayout.SOUTH); } public void updateMessageDisplay() { message.setText(formatMessage()); } private 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(); } public void addContinueButtonListener(ActionListener al) { continueButton.addActionListener(al); } }