author | goetz |
Tue, 09 Dec 2014 11:57:46 +0100 | |
changeset 28187 | fc19df82d6ee |
parent 24184 | 4da2f6ec4dab |
child 27764 | 4e79ff3e0602 |
permissions | -rw-r--r-- |
24184
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
1 |
/* |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
4 |
* |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
8 |
* |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
13 |
* accompanied this code). |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
14 |
* |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
18 |
* |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
21 |
* questions. |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
22 |
*/ |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
23 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
24 |
/* @test |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
25 |
* @bug 8032874 |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
26 |
* @summary Test whether ArrayIndexOutOfBoundsException is thrown or not, |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
27 |
* once selected row is removed from JTable with Sorter and Filter |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
28 |
* @author Dmitry Markov |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
29 |
* @run main bug8032874 |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
30 |
*/ |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
31 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
32 |
import java.awt.*; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
33 |
import java.util.ArrayList; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
34 |
import java.util.List; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
35 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
36 |
import javax.swing.*; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
37 |
import javax.swing.table.AbstractTableModel; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
38 |
import javax.swing.table.TableRowSorter; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
39 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
40 |
import sun.awt.SunToolkit; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
41 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
42 |
public class bug8032874 { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
43 |
private static final int ROW_COUNT = 5; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
44 |
private static JTable table; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
45 |
private static TestTableModel tableModel; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
46 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
47 |
public static void main(String args[]) throws Exception { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
48 |
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
49 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
50 |
SwingUtilities.invokeAndWait(new Runnable() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
51 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
52 |
public void run() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
53 |
createAndShowUI(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
54 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
55 |
}); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
56 |
toolkit.realSync(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
57 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
58 |
SwingUtilities.invokeAndWait(new Runnable() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
59 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
60 |
public void run() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
61 |
table.getRowSorter().toggleSortOrder(0); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
62 |
table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
63 |
table.setRowSelectionInterval(1, 2); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
64 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
65 |
}); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
66 |
toolkit.realSync(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
67 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
68 |
SwingUtilities.invokeAndWait(new Runnable() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
69 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
70 |
public void run() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
71 |
for (int i = 0; i < ROW_COUNT; i++) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
72 |
tableModel.remove(0); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
73 |
table.getRowSorter().toggleSortOrder(0); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
74 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
75 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
76 |
}); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
77 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
78 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
79 |
public static void createAndShowUI() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
80 |
try { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
81 |
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
82 |
} catch (Exception e) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
83 |
throw new RuntimeException(e); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
84 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
85 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
86 |
JFrame frame = new JFrame("bug8032874"); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
87 |
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
88 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
89 |
JPanel panel = new JPanel(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
90 |
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
91 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
92 |
tableModel = new TestTableModel(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
93 |
table = new JTable(tableModel); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
94 |
table.setSurrendersFocusOnKeystroke(true); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
95 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
96 |
final TableRowSorter<TestTableModel> rowSorter = new TableRowSorter<TestTableModel>(tableModel); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
97 |
rowSorter.setRowFilter(new RowFilter<TestTableModel, Integer>() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
98 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
99 |
public boolean include(Entry<? extends TestTableModel, ? extends Integer> entry) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
100 |
return entry.getIdentifier() % 2 == 0; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
101 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
102 |
}); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
103 |
table.setRowSorter(rowSorter); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
104 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
105 |
JScrollPane jScrollPane = new JScrollPane(table); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
106 |
panel.add(jScrollPane); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
107 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
108 |
frame.setContentPane(panel); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
109 |
frame.setSize(new Dimension(800, 600)); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
110 |
frame.setVisible(true); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
111 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
112 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
113 |
private static class TestTableModel extends AbstractTableModel { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
114 |
private final List<Integer> data; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
115 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
116 |
public TestTableModel() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
117 |
data = new ArrayList<Integer>(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
118 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
119 |
for (int i = 0; i < ROW_COUNT; i++) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
120 |
data.add(i); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
121 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
122 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
123 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
124 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
125 |
public int getRowCount() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
126 |
return data.size(); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
127 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
128 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
129 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
130 |
public int getColumnCount() { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
131 |
return 1; |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
132 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
133 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
134 |
@Override |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
135 |
public Object getValueAt(int rowIndex, int columnIndex) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
136 |
return data.get(rowIndex); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
137 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
138 |
|
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
139 |
public void remove(int row) { |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
140 |
data.remove(row); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
141 |
fireTableRowsDeleted(row, row); |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
142 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
143 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
144 |
} |
4da2f6ec4dab
8032874: ArrayIndexOutOfBoundsException in JTable while clearing data in JTable
dmarkov
parents:
diff
changeset
|
145 |