author | vromero |
Thu, 05 Jan 2017 11:16:39 -0800 | |
changeset 43033 | c37b643739a7 |
parent 27501 | 270a993c1881 |
permissions | -rw-r--r-- |
27501
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
1 |
/* |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
2 |
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
4 |
* |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
8 |
* |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
13 |
* accompanied this code). |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
14 |
* |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
18 |
* |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
21 |
* questions. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
22 |
*/ |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
23 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
24 |
import java.awt.Color; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
25 |
import java.awt.Container; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
26 |
import java.awt.Dimension; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
27 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
28 |
import javax.swing.DefaultCellEditor; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
29 |
import javax.swing.JApplet; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
30 |
import javax.swing.JComboBox; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
31 |
import javax.swing.JLabel; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
32 |
import javax.swing.JScrollPane; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
33 |
import javax.swing.JTable; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
34 |
import javax.swing.SwingUtilities; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
35 |
import javax.swing.UIManager; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
36 |
import javax.swing.border.BevelBorder; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
37 |
import javax.swing.table.AbstractTableModel; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
38 |
import javax.swing.table.DefaultTableCellRenderer; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
39 |
import javax.swing.table.TableCellRenderer; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
40 |
import javax.swing.table.TableColumn; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
41 |
import javax.swing.table.TableModel; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
42 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
43 |
/** |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
44 |
* @test |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
45 |
* @bug 4128521 |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
46 |
* @summary |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
47 |
* Tabbing test |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
48 |
* @author milne |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
49 |
* @run applet/manual=yesno TAB.html |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
50 |
*/ |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
51 |
public class TAB extends JApplet |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
52 |
{ |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
53 |
static void initTest(Container contentPane) |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
54 |
{ |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
55 |
// Take the dummy data from SwingSet. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
56 |
final String[] names = {"First Name", "Last Name", "Favorite Color", |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
57 |
"Favorite Number", "Vegetarian"}; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
58 |
final Object[][] data = { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
59 |
{"Mark", "Andrews", "Red", new Integer(2), new Boolean(true)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
60 |
{"Tom", "Ball", "Blue", new Integer(99), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
61 |
{"Alan", "Chung", "Green", new Integer(838), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
62 |
{"Jeff", "Dinkins", "Turquois", new Integer(8), new Boolean(true)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
63 |
{"Amy", "Fowler", "Yellow", new Integer(3), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
64 |
{"Brian", "Gerhold", "Green", new Integer(0), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
65 |
{"James", "Gosling", "Pink", new Integer(21), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
66 |
{"David", "Karlton", "Red", new Integer(1), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
67 |
{"Dave", "Kloba", "Yellow", new Integer(14), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
68 |
{"Peter", "Korn", "Purple", new Integer(12), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
69 |
{"Phil", "Milne", "Purple", new Integer(3), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
70 |
{"Dave", "Moore", "Green", new Integer(88), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
71 |
{"Hans", "Muller", "Maroon", new Integer(5), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
72 |
{"Rick", "Levenson", "Blue", new Integer(2), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
73 |
{"Tim", "Prinzing", "Blue", new Integer(22), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
74 |
{"Chester", "Rose", "Black", new Integer(0), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
75 |
{"Ray", "Ryan", "Gray", new Integer(77), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
76 |
{"Georges", "Saab", "Red", new Integer(4), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
77 |
{"Willie", "Walker", "Phthalo Blue", new Integer(4), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
78 |
{"Kathy", "Walrath", "Blue", new Integer(8), new Boolean(false)}, |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
79 |
{"Arnaud", "Weber", "Green", new Integer(44), new Boolean(false)} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
80 |
}; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
81 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
82 |
// Create a model of the data. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
83 |
TableModel dataModel = new AbstractTableModel() { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
84 |
// These methods always need to be implemented. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
85 |
public int getColumnCount() { return names.length; } |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
86 |
public int getRowCount() { return data.length;} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
87 |
public Object getValueAt(int row, int col) {return data[row][col];} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
88 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
89 |
// The default implementations of these methods in |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
90 |
// AbstractTableModel would work, but we can refine them. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
91 |
public String getColumnName(int column) {return names[column];} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
92 |
public Class getColumnClass(int c) {return getValueAt(0, c).getClass();} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
93 |
public boolean isCellEditable(int row, int col) {return true;} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
94 |
public void setValueAt(Object aValue, int row, int column) { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
95 |
System.out.println("Setting value to: " + aValue); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
96 |
data[row][column] = aValue; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
97 |
} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
98 |
}; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
99 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
100 |
// Create the table |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
101 |
JTable tableView = new JTable(dataModel); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
102 |
// Turn off auto-resizing so that we can set column sizes programmatically. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
103 |
// In this mode, all columns will get their preferred widths, as set blow. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
104 |
tableView.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
105 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
106 |
// Create a combo box to show that you can use one in a table. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
107 |
JComboBox comboBox = new JComboBox(); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
108 |
comboBox.addItem("Red"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
109 |
comboBox.addItem("Orange"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
110 |
comboBox.addItem("Yellow"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
111 |
comboBox.addItem("Green"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
112 |
comboBox.addItem("Blue"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
113 |
comboBox.addItem("Indigo"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
114 |
comboBox.addItem("Violet"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
115 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
116 |
TableColumn colorColumn = tableView.getColumn("Favorite Color"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
117 |
// Use the combo box as the editor in the "Favorite Color" column. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
118 |
colorColumn.setCellEditor(new DefaultCellEditor(comboBox)); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
119 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
120 |
// Set a pink background and tooltip for the Color column renderer. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
121 |
DefaultTableCellRenderer colorColumnRenderer = new DefaultTableCellRenderer(); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
122 |
colorColumnRenderer.setBackground(Color.pink); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
123 |
colorColumnRenderer.setToolTipText("Click for combo box"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
124 |
colorColumn.setCellRenderer(colorColumnRenderer); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
125 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
126 |
// Set a tooltip for the header of the colors column. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
127 |
TableCellRenderer headerRenderer = colorColumn.getHeaderRenderer(); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
128 |
if (headerRenderer instanceof DefaultTableCellRenderer) |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
129 |
((DefaultTableCellRenderer)headerRenderer).setToolTipText("Hi Mom!"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
130 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
131 |
// Set the width of the "Vegetarian" column. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
132 |
TableColumn vegetarianColumn = tableView.getColumn("Vegetarian"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
133 |
vegetarianColumn.setPreferredWidth(100); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
134 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
135 |
// Show the values in the "Favorite Number" column in different colors. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
136 |
TableColumn numbersColumn = tableView.getColumn("Favorite Number"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
137 |
DefaultTableCellRenderer numberColumnRenderer = new DefaultTableCellRenderer() { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
138 |
public void setValue(Object value) { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
139 |
int cellValue = (value instanceof Number) ? ((Number)value).intValue() : 0; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
140 |
setForeground((cellValue > 30) ? Color.black : Color.red); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
141 |
setText((value == null) ? "" : value.toString()); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
142 |
} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
143 |
}; |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
144 |
numberColumnRenderer.setHorizontalAlignment(JLabel.RIGHT); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
145 |
numbersColumn.setCellRenderer(numberColumnRenderer); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
146 |
numbersColumn.setPreferredWidth(110); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
147 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
148 |
// Finish setting up the table. |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
149 |
JScrollPane scrollpane = new JScrollPane(tableView); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
150 |
scrollpane.setBorder(new BevelBorder(BevelBorder.LOWERED)); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
151 |
scrollpane.setPreferredSize(new Dimension(430, 200)); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
152 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
153 |
contentPane.add(scrollpane); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
154 |
} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
155 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
156 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
157 |
public void init() { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
158 |
SwingUtilities.invokeLater(() -> { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
159 |
try { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
160 |
UIManager.setLookAndFeel( |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
161 |
"javax.swing.plaf.metal.MetalLookAndFeel"); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
162 |
} catch (Exception e) { |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
163 |
throw new RuntimeException(e); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
164 |
} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
165 |
|
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
166 |
initTest(getContentPane()); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
167 |
}); |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
168 |
} |
270a993c1881
7154054: [macosx] Can't distinguish the focus move to next cell
serb
parents:
diff
changeset
|
169 |
} |