01: package org.netbeans.jemmy.testing;
02:
03: import java.awt.*;
04:
05: import java.awt.event.*;
06:
07: import javax.swing.*;
08: import javax.swing.tree.*;
09:
10: public class Application_024 extends TestFrame {
11:
12: JTable tbl;
13:
14: public Application_024() {
15: super ("Application_024");
16:
17: JTabbedPane tp = new JTabbedPane();
18:
19: //////////////////////////////////////////////////////////////////////
20: //table
21: //////////////////////////////////////////////////////////////////////
22: String[] tableColumns = new String[50];
23: String[][] tableItems = new String[50][50];
24: for (int i = 0; i < tableColumns.length; i++) {
25: tableColumns[i] = Integer.toString(i);
26: for (int j = 0; j < tableItems[i].length; j++) {
27: tableItems[j][i] = Integer.toString(i)
28: + Integer.toString(j);
29: }
30: }
31: tableItems[0][1] = null;
32: tableItems[1][0] = null;
33: tableItems[3][2] = null;
34: tbl = new JTable(tableItems, tableColumns);
35: tbl.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
36:
37: tp.add("Table Page", new JScrollPane(tbl));
38:
39: //////////////////////////////////////////////////////////////////////
40: //tree
41: //////////////////////////////////////////////////////////////////////
42: DefaultMutableTreeNode root = new DefaultMutableTreeNode("-1");
43: DefaultMutableTreeNode node = null;
44: DefaultTreeModel model = new DefaultTreeModel(root);
45: JTree tr = new JTree(root);
46: tr.setModel(model);
47: for (int i = 0; i < 50; i++) {
48: node = new DefaultMutableTreeNode(Integer.toString(i));
49: model.insertNodeInto(node, root, i);
50: for (int j = 0; j < 50; j++) {
51: model.insertNodeInto(new DefaultMutableTreeNode(Integer
52: .toString(i)
53: + Integer.toString(j)), node, j);
54: }
55: }
56: tr.expandRow(0);
57: tr.setEditable(true);
58: tp.add("Tree Page", new JScrollPane(tr));
59:
60: //////////////////////////////////////////////////////////////////////
61: //list
62: //////////////////////////////////////////////////////////////////////
63: String[] listItems = new String[50];
64: for (int i = 0; i < listItems.length; i++) {
65: listItems[i] = Integer.toString(i);
66: }
67: tp.add("List Page", new JScrollPane(new JList(listItems)));
68:
69: //////////////////////////////////////////////////////////////////////
70: //text
71: //////////////////////////////////////////////////////////////////////
72: String text = "";
73: for (int i = 0; i < 50; i++) {
74: for (int j = 0; j < 50; j++) {
75: text = text + Integer.toString(i) + Integer.toString(j);
76: }
77: text = text + "\n";
78: }
79: text = text.substring(0, text.length() - 1);
80: tp.add("Text Page", new JScrollPane(new JTextArea(text)));
81:
82: getContentPane().add(tp);
83:
84: setSize(400, 400);
85: }
86:
87: public static void main(String[] argv) {
88: Application_024 app = new Application_024();
89: app.show();
90: System.out.println(app.tbl.getValueAt(1, 0));
91: System.out.println(app.tbl.getValueAt(1, 0));
92: }
93: }
|