KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > swing > gridsplit > TestComponent


1 /*
2  * TestComponent.java
3  *
4  * Created on April 27, 2005, 4:44 PM
5  */

6
7 package org.netbeans.swing.gridsplit;
8
9 /**
10  *
11  * @author Tim Boudreau
12  */

13
14 //import java.awt.BorderLayout;
15
import java.awt.Component JavaDoc;
16 //import java.awt.Dimension;
17
import java.awt.GridBagConstraints JavaDoc;
18 import java.awt.GridBagLayout JavaDoc;
19 import java.awt.Insets JavaDoc;
20 //import java.awt.event.ActionEvent;
21
//import java.awt.event.ActionListener;
22
//import java.awt.event.WindowListener;
23
//import java.util.Collection;
24
//import java.util.Iterator;
25
import javax.swing.AbstractAction JavaDoc;
26 import javax.swing.JButton JavaDoc;
27 //import javax.swing.JCheckBoxMenuItem;
28
import javax.swing.JComponent JavaDoc;
29 import javax.swing.JFrame JavaDoc;
30 //import javax.swing.JMenu;
31
//import javax.swing.JMenuItem;
32
import javax.swing.JPanel JavaDoc;
33 //import javax.swing.JPopupMenu;
34
//import javax.swing.JScrollPane;
35
//import javax.swing.JTree;
36

37
38 public class TestComponent extends JPanel JavaDoc {
39     
40     private int index;
41     Test t;
42     String JavaDoc s;
43     
44     public TestComponent(Test test) {
45         t=test;
46         setLayout( new GridBagLayout JavaDoc() );
47         this.index = Test.index++;
48     }
49     
50     public void setID(String JavaDoc text){
51         //final JButton btn = new JButton( str);
52
//add( btn, new GridBagConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0 ,0 ) );
53

54         javax.swing.JTextField JavaDoc jTextField1 = new javax.swing.JTextField JavaDoc();
55         jTextField1.setEditable(false);
56         jTextField1.setText("dsfafdaf\nalalalal");
57         
58         // add(jTextField1, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0 ,0 ) );
59
javax.swing.JTextArea JavaDoc jTextArea1 = new javax.swing.JTextArea JavaDoc();
60         jTextArea1.setEditable(false);
61         jTextArea1.setText(text);
62         add(jTextArea1,new GridBagConstraints JavaDoc( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets JavaDoc(0,0,0,0), 0 ,0 ) );
63         
64     }
65     
66     public String JavaDoc toString() {
67         return "Comp " + index;
68     }
69     
70 }
71
72
73
Popular Tags