|
3 | 3 | import java.awt.BorderLayout; |
4 | 4 | import java.awt.Color; |
5 | 5 | import java.awt.EventQueue; |
| 6 | +import java.awt.Font; |
6 | 7 | import java.awt.GridLayout; |
7 | 8 | import java.awt.event.ActionEvent; |
8 | 9 | import java.awt.event.ActionListener; |
|
11 | 12 | import javax.swing.Action; |
12 | 13 | import javax.swing.ActionMap; |
13 | 14 | import javax.swing.BoxLayout; |
| 15 | +import javax.swing.DefaultListModel; |
14 | 16 | import javax.swing.JButton; |
15 | 17 | import javax.swing.JFrame; |
16 | | -import javax.swing.JLabel; |
| 18 | +import javax.swing.JList; |
17 | 19 | import javax.swing.JPanel; |
18 | | -import javax.swing.JScrollPane; |
19 | 20 | import javax.swing.JTable; |
20 | 21 | import javax.swing.JTextArea; |
| 22 | +import javax.swing.ListSelectionModel; |
21 | 23 | import javax.swing.SwingUtilities; |
22 | 24 | import javax.swing.TransferHandler; |
23 | 25 | import javax.swing.table.DefaultTableModel; |
24 | | -import javax.swing.table.TableColumnModel; |
25 | 26 |
|
26 | 27 | import swingjs.plaf.JSTableUI; |
27 | 28 |
|
@@ -56,6 +57,8 @@ public void invokeAction(String name, Action altAction) { |
56 | 57 |
|
57 | 58 | } |
58 | 59 |
|
| 60 | + private DefaultListModel listModel; |
| 61 | + |
59 | 62 | public Test_Clipboard() { |
60 | 63 | super(); |
61 | 64 | JPanel p = new JPanel(); |
@@ -97,13 +100,29 @@ public Test_Clipboard() { |
97 | 100 | table.setFillsViewportHeight(true); |
98 | 101 | table.setBackground(Color.yellow); |
99 | 102 | //table.setRowHeight(10); // very tight! exact match |
100 | | - table.setRowMargin(10); |
| 103 | + //table.setRowMargin(10); |
101 | 104 | table.getColumnModel().setColumnMargin(10); |
102 | 105 | //JScrollPane scrollPane = new JScrollPane(table); |
103 | 106 |
|
104 | 107 | //p.add(scrollPane); |
105 | 108 | p.add(table); |
106 | 109 |
|
| 110 | + listModel = new DefaultListModel(); |
| 111 | + listModel.addElement("Jane Doe"); |
| 112 | + listModel.addElement("John Smith"); |
| 113 | + listModel.addElement("Kathy Green"); |
| 114 | + listModel.addElement("Rose Red"); |
| 115 | + listModel.addElement("Nearly Black"); |
| 116 | + listModel.addElement("Pearly White"); |
| 117 | + // Create the list and put it in a scroll pane. |
| 118 | + JList list = new JList(listModel); |
| 119 | + list.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 24)); |
| 120 | + list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
| 121 | + list.setSelectedIndex(0); |
| 122 | + //list.addListSelectionListener(this); |
| 123 | + list.setVisibleRowCount(5); |
| 124 | + p.add(list); |
| 125 | + |
107 | 126 | JPanel m = new JPanel(new GridLayout()); |
108 | 127 |
|
109 | 128 | JButton btn = new JButton("copy text"); |
|
0 commit comments