/Users/lyon/j4p/src/gui/run/RunTextFieldOld.java

1    package gui.run; 
2     
3    import javax.swing.*; 
4    import java.awt.event.ActionListener; 
5     
6     
7    public abstract class RunTextFieldOld extends 
8            JTextField implements ActionListener, Runnable { 
9        private String sTxt; 
10       private String originalText = null; 
11    
12       public String getOriginalText() { 
13           return originalText; 
14       } 
15    
16       public RunTextFieldOld(String text) { 
17           super(text); 
18           originalText = text; 
19           addActionListener(this); 
20           ShortcutUtils.addShortcut(this); 
21       } 
22    
23    
24       public RunTextFieldOld() { 
25           this(""); 
26       } 
27    
28       public RunTextFieldOld(int columns) { 
29           super(columns); 
30           addActionListener(this); 
31       } 
32    
33       public RunTextFieldOld(String text, int columns) { 
34           super(text, columns); 
35           addActionListener(this); 
36       } 
37    
38       public RunTextFieldOld(javax.swing.text.Document doc, String text, int columns) { 
39           super(doc, text, columns); 
40           addActionListener(this); 
41       } 
42    
43       public void actionPerformed(java.awt.event.ActionEvent e) { 
44           run(); 
45       } 
46    
47       public static void main(String args[]) { 
48           gui.ClosableJFrame cf = new gui.ClosableJFrame("RunTextField"); 
49           java.awt.Container c = cf.getContentPane(); 
50           c.add(new RunTextFieldOld("[aWhat is your name?") { 
51               public void run() { 
52                   System.out.println(getText()); 
53               } 
54           }); 
55           c.add(new RunTextFieldOld("[bWhat is your name?") { 
56               public void run() { 
57                   System.out.println(getText()); 
58               } 
59           }); 
60           c.setLayout(new java.awt.GridLayout(4, 0)); 
61           cf.setSize(200, 200); 
62           cf.setVisible(true); 
63       } 
64    
65   }