01: /*
02: JSmooth: a VM wrapper toolkit for Windows
03: Copyright (C) 2003-2007 Rodrigo Reyes <reyes@charabia.net>
04:
05: This program is free software; you can redistribute it and/or modify
06: it under the terms of the GNU General Public License as published by
07: the Free Software Foundation; either version 2 of the License, or
08: (at your option) any later version.
09:
10: This program is distributed in the hope that it will be useful,
11: but WITHOUT ANY WARRANTY; without even the implied warranty of
12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: GNU General Public License for more details.
14:
15: You should have received a copy of the GNU General Public License
16: along with this program; if not, write to the Free Software
17: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18:
19: */
20:
21: package net.charabia.jsmoothgen.application.gui.skeleditors;
22:
23: import javax.swing.*;
24: import javax.swing.event.*;
25: import javax.swing.text.*;
26: import java.util.*;
27:
28: public class StringEditor extends SkelPropEditor {
29: JTextField m_comp;
30:
31: public StringEditor() {
32: m_comp = new JTextField();
33: PlainDocument doc = new PlainDocument();
34: // doc.addDocumentListener(new DocumentListener() {
35: // public void insertUpdate(DocumentEvent e) { StringEditor.this.set(m_comp.getText()); }
36: // public void removeUpdate(DocumentEvent e) { StringEditor.this.set(m_comp.getText()); }
37: // public void changedUpdate(DocumentEvent e){ StringEditor.this.set(m_comp.getText()); }
38: // });
39: m_comp.setDocument(doc);
40: }
41:
42: public java.awt.Component getGUI() {
43: return m_comp;
44: }
45:
46: public void valueChanged(String val) {
47: m_comp.setText(val);
48: }
49:
50: public void set(String o) {
51: m_comp.setText(o);
52: }
53:
54: public String get() {
55: return m_comp.getText();
56: }
57:
58: }
|