fiore@0: /* fiore@0: CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool fiore@0: fiore@0: Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/) fiore@0: fiore@0: This program is free software: you can redistribute it and/or modify fiore@0: it under the terms of the GNU General Public License as published by fiore@0: the Free Software Foundation, either version 3 of the License, or fiore@0: (at your option) any later version. fiore@0: fiore@0: This program is distributed in the hope that it will be useful, fiore@0: but WITHOUT ANY WARRANTY; without even the implied warranty of fiore@0: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fiore@0: GNU General Public License for more details. fiore@0: fiore@0: You should have received a copy of the GNU General Public License fiore@0: along with this program. If not, see . fiore@0: */ fiore@0: fiore@0: package uk.ac.qmul.eecs.ccmi.simpletemplate; fiore@0: fiore@0: import java.awt.Frame; fiore@0: import java.awt.event.ActionEvent; fiore@0: import java.awt.event.KeyEvent; fiore@0: import java.util.ResourceBundle; fiore@0: fiore@0: import javax.swing.AbstractAction; fiore@0: import javax.swing.JButton; fiore@0: import javax.swing.JComponent; fiore@0: import javax.swing.JRootPane; fiore@0: import javax.swing.KeyStroke; fiore@0: import javax.swing.event.ChangeEvent; fiore@0: fiore@0: import jwizardcomponent.dialog.SimpleJWizardDialog; fiore@0: fiore@0: /* fiore@0: * The dialog where the template wizard is displayed fiore@0: * fiore@0: * @see Wizard fiore@0: * fiore@0: */ fiore@0: @SuppressWarnings("serial") fiore@0: public class SpeechWizardDialog extends SimpleJWizardDialog { fiore@0: public SpeechWizardDialog(Frame owner){ fiore@0: super(owner,true); fiore@0: finished = false; fiore@0: fiore@0: ResourceBundle resources = ResourceBundle.getBundle(getClass().getName()); fiore@0: setSize(350, 200); fiore@0: setTitle(resources.getString("dialog.wizard.title")); fiore@0: setLocationRelativeTo(owner); fiore@0: fiore@0: JButton button; fiore@0: button = getWizardComponents().getNextButton(); fiore@0: button.setText(resources.getString("button.next.label")); fiore@0: button.getAccessibleContext().setAccessibleName(resources.getString("button.next.speech")); fiore@0: fiore@0: button = getWizardComponents().getBackButton(); fiore@0: button.setText(resources.getString("button.previous.label")); fiore@0: button.getAccessibleContext().setAccessibleName(resources.getString("button.previous.speech")); fiore@0: fiore@0: button = getWizardComponents().getCancelButton(); fiore@0: button.setText(resources.getString("button.cancel.label")); fiore@0: fiore@0: button = getWizardComponents().getFinishButton(); fiore@0: button.setText(resources.getString("button.finish.label")); fiore@0: button.addChangeListener(new javax.swing.event.ChangeListener(){ fiore@0: @Override fiore@0: public void stateChanged(ChangeEvent e) { fiore@0: ((JButton)e.getSource()).setEnabled(finished); fiore@0: } fiore@0: }); fiore@0: JRootPane rootPane = getRootPane(); fiore@0: rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0), "close"); fiore@0: rootPane.getActionMap().put("close", new AbstractAction(){ fiore@0: @Override fiore@0: public void actionPerformed(ActionEvent arg0) { fiore@0: dispose(); fiore@0: } fiore@0: }); fiore@0: } fiore@0: fiore@0: /** fiore@0: * Enables or disables the finish button. fiore@0: * @param enabled fiore@0: */ fiore@0: public void setFinishButtonEnabled(boolean enabled){ fiore@0: finished = enabled; fiore@0: getWizardComponents().getFinishButton().setEnabled(true); fiore@0: } fiore@0: fiore@0: private boolean finished; fiore@0: } fiore@0: