01: package org.netbeans.jemmy.testing;
02:
03: import java.awt.*;
04:
05: import java.awt.event.*;
06:
07: import javax.swing.*;
08:
09: public class Application_001 extends TestDialog {
10:
11: JComboBox editable;
12: DefaultComboBoxModel editableModel;
13:
14: public Application_001() {
15: super ("Application_001");
16:
17: getContentPane().setLayout(new BorderLayout());
18:
19: JPanel pane = new JPanel();
20: GridBagLayout gridbag = new GridBagLayout();
21: GridBagConstraints c = new GridBagConstraints();
22: pane.setLayout(gridbag);
23:
24: getContentPane()
25: .add(new JScrollPane(pane), BorderLayout.CENTER);
26:
27: String[] editable_contents = { "editable_one", "editable_two",
28: "editable_three", "editable_four" };
29: editableModel = new DefaultComboBoxModel(editable_contents);
30: editable = new JComboBox(editableModel);
31: editable.setEditable(true);
32: editable.getEditor().addActionListener(new ActionListener() {
33: public void actionPerformed(ActionEvent e) {
34: editableModel
35: .addElement(editable.getEditor().getItem());
36: }
37: });
38: editable.setName("editable");
39:
40: c.fill = GridBagConstraints.CENTER;
41: c.gridwidth = GridBagConstraints.REMAINDER;
42: c.gridheight = 1;
43: c.weighty = 1.0;
44: gridbag.setConstraints(editable, c);
45: pane.add(editable);
46:
47: String[] list_contents = { "list_one", "list_two",
48: "list_three", "list_four" };
49: JList list = new JList(list_contents);
50: list.setName("list");
51:
52: c.gridwidth = GridBagConstraints.REMAINDER;
53: c.gridheight = 2;
54: c.weighty = 1.0;
55: gridbag.setConstraints(list, c);
56: pane.add(list);
57:
58: String[] non_editable_contents = { "non_editable_one",
59: "non_editable_two", "non_editable_three",
60: "non_editable_four" };
61: JComboBox non_editable = new JComboBox(non_editable_contents);
62: non_editable.setEditable(false);
63: non_editable.setName("non_editable");
64:
65: c.gridwidth = GridBagConstraints.REMAINDER;
66: c.gridheight = 1;
67: c.weighty = 1.0;
68: gridbag.setConstraints(non_editable, c);
69: pane.add(non_editable);
70:
71: setSize(200, 200);
72:
73: setModal(true);
74: }
75:
76: public static void main(String[] argv) {
77: (new Application_001()).setVisible(true);
78: }
79: }
|