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

1    package gui.run; 
2     
3    import gui.ClosableJFrame; 
4     
5    import javax.swing.*; 
6    import java.awt.*; 
7     
8    /** 
9     * DocJava, Inc. 
10    * http://www.docjava.com 
11    * Programmer: dlyon 
12    * Date: Mar 31, 2004 
13    * Time: 7:18:20 PM 
14    */ 
15   public class RunLabel extends JLabel { 
16       RunLabel(String text, Icon icon, int horizontalAlignment) { 
17           super(text, icon, horizontalAlignment); 
18           ShortcutUtils.addShortcut(this); 
19       } 
20    
21       public RunLabel(String text, int horizontalAlignment) { 
22           this(text, null, horizontalAlignment); 
23       } 
24    
25       public RunLabel(String text) { 
26           this(text, null, LEADING); 
27       } 
28    
29       public RunLabel(Icon image, int horizontalAlignment) { 
30           this(null, image, horizontalAlignment); 
31       } 
32    
33       public RunLabel(Icon image) { 
34           this(null, image, CENTER); 
35       } 
36    
37       public RunLabel() { 
38           this("", null, LEADING); 
39       } 
40    
41       public static void main(String[] args) { 
42           ClosableJFrame cj = new ClosableJFrame(); 
43           Container c = cj.getContentPane(); 
44           c.setLayout(new FlowLayout()); 
45           JPanel labelPanel = new JPanel(); 
46           labelPanel.setLayout(new GridLayout(0,1)); 
47           JPanel textFieldPanel = new JPanel(); 
48           textFieldPanel.setLayout(new GridLayout(0,1)); 
49           labelPanel.add(new RunLabel("[Name")); 
50           RunTextFieldOld runTextFieldOld = new RunTextFieldOld("[Name") { 
51                       public void run() { 
52    
53                       } 
54                   }; 
55           runTextFieldOld.setText(""); 
56           textFieldPanel.add(runTextFieldOld); 
57           labelPanel.add(new RunLabel("[House/Street")); 
58           textFieldPanel.add(new RunTextFieldOld("[House") { 
59               public void run() { 
60    
61               } 
62           }); 
63           c.add(textFieldPanel); 
64           c.add(labelPanel); 
65           cj.setSize(200, 200); 
66           cj.show(); 
67       } 
68    
69   } 
70