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: //
10:
11: package de.uka.ilkd.key.casetool.patternimplementor;
12:
13: import java.awt.Dimension;
14: import java.awt.GridLayout;
15: import java.awt.event.ActionEvent;
16: import java.awt.event.FocusEvent;
17: import java.awt.event.FocusListener;
18:
19: import javax.swing.JLabel;
20: import javax.swing.JTextField;
21:
22: public class PIParameterGUIString extends PIParameterGUI implements
23: FocusListener {
24:
25: public PIParameterGUIString(PIParameterString pip) {
26: super (pip);
27: }
28:
29: public void focusGained(FocusEvent e) {
30: }
31:
32: public void focusLost(FocusEvent e) {
33: //System.out.println(e);
34: Object source = e.getSource();
35: ((PIParameterString) pip).setValue(((JTextField) source)
36: .getText());
37: }
38:
39: protected void buildGUI() {
40: this .setLayout(new GridLayout(1, 2));
41: this .add(new JLabel(pip.getName()));
42: content = new JTextField();
43: ((JTextField) content).addActionListener(this );
44: content.addFocusListener(this );
45:
46: //((JTextField)content).getDocument().addDocumentListener(this);
47: content.setPreferredSize(new Dimension(200, 20));
48: this .add(content);
49: updateGUI();
50: }
51:
52: public void actionPerformed(ActionEvent e) {
53: Object source = e.getSource();
54:
55: //System.out.println("actionPerformed on: " + pip.getName());
56:
57: ((PIParameterString) pip).setValue(((JTextField) source)
58: .getText());
59: }
60:
61: protected void updateGUI() {
62: //System.out.println("GUI.updateGUI "+pip.getName());
63: ((JTextField) content).setText(((PIParameterString) pip)
64: .getValue());
65: }
66: }
|