01: // This file is part of KeY - Integrated Deductive Software Design
02: // Copyright (C) 2001-2007 Universitaet Karlsruhe, Germany
03: // Universitaet Koblenz-Landau, Germany
04: // Chalmers University of Technology, Sweden
05: //
06: // The KeY system is protected by the GNU General Public License.
07: // See LICENSE.TXT for details.
08: /*
09: * Created on 30.03.2005
10: */
11: package de.uka.ilkd.key.gui.notification.actions;
12:
13: import java.awt.Component;
14:
15: import javax.swing.JOptionPane;
16:
17: import de.uka.ilkd.key.gui.notification.events.GeneralInformationEvent;
18: import de.uka.ilkd.key.gui.notification.events.NotificationEvent;
19:
20: /**
21: * Displays a string in a {@link javax.swing.JOptionPane} information
22: * message window.
23: * @author bubel
24: */
25: public class GeneralInformationJTextPaneDisplay extends ShowDisplayPane {
26:
27: /**
28: */
29: public GeneralInformationJTextPaneDisplay(Component parentComponent) {
30: super (parentComponent);
31: }
32:
33: /**
34: * @see
35: * de.uka.ilkd.key.gui.notification.NotificationAction#execute(NotificationEvent)
36: */
37: public boolean execute(NotificationEvent event) {
38: final String title;
39: if (event instanceof GeneralInformationEvent) {
40: setMessage(((GeneralInformationEvent) event).getMessage());
41: title = ((GeneralInformationEvent) event).getContext();
42: } else {
43: setMessage("Info: " + event);
44: title = "Information";
45: }
46: JOptionPane.showMessageDialog(parentComponent, getMessage(),
47: title, JOptionPane.INFORMATION_MESSAGE);
48: return true;
49: }
50:
51: }
|