[FIELDSET][/FIELDSET]Hallo
Situation: Ich habe einen JTable welcher über den DefaultTableModel (Vector, Vector) eingelesen.
JTable wird erzeugt
Einlesen des Vectors
Problem:
Das automatische Ändern von Daten geht ohne Fehlermeldung, nur über der GUI nicht.
Ist die Option für JTable sortieren ausgewählt und ich wähle über die GUI über JTabl einen Boolean wert aus, so bekomme ich den Fehler:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Invalid range
at javax.swing.DefaultRowSorter.rowsUpdated(Unknown Source)
at javax.swing.DefaultRowSorter.rowsUpdated(Unknown Source)
at javax.swing.JTable.notifySorter(Unknown Source)
at javax.swing.JTable.sortedTableChanged(Unknown Source)
at javax.swing.JTable.tableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableCellUpdated(Unknown Source)
at javax.swing.table.DefaultTableModel.setValueAt(Unknown Source)
at javax.swing.JTable.setValueAt(Unknown Source)
at javax.swing.JTable.editingStopped(Unknown Source)
at javax.swing.AbstractCellEditor.fireEditingStopped(Unknown Source)
at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(Unknown Source)
at javax.swing.DefaultCellEditor.stopCellEditing(Unknown Source)
at javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Frage:
1. Liegt es an den Vector?
Danke
Situation: Ich habe einen JTable welcher über den DefaultTableModel (Vector, Vector) eingelesen.
JTable wird erzeugt
Java:
JScrollPane scrollPaneForFileAFolder = new JScrollPane();
tabbedPane.addTab(Messages.getString("DestkopCleanGui.1"), null,
scrollPaneForFileAFolder, null);
tableForFileAFolderOverview = new JTable();
tableForFileAFolderOverview.setRowSelectionAllowed(false);
tableForFileAFolderOverview.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tableForFileAFolderOverview.setFillsViewportHeight(true);
scrollPaneForFileAFolder.setViewportView(tableForFileAFolderOverview);
tableForFileAFolderOverview.setModel(new DefaultTableModel(
tableForFileAFolderOverviewDatabase,
tableFileAFolderOverviewHead) {
Class[] columnTypes = new Class[] { Boolean.class, Boolean.class,
String.class, String.class, String.class, Boolean.class,
Boolean.class };
public Class getColumnClass(int columnIndex) {
return columnTypes[columnIndex];
}
boolean[] columnEditables = new boolean[] { true, true, false,
false, false, false, false };
public boolean isCellEditable(int row, int column) {
return columnEditables[column];
}
});
tableForFileAFolderOverview.setAutoCreateRowSorter(true);
tableForFileAFolderOverview.getColumnModel().getColumn(0)
.setPreferredWidth(100);
tableForFileAFolderOverview.getColumnModel().getColumn(0)
.setMaxWidth(999);
tableForFileAFolderOverview.getColumnModel().getColumn(1)
.setPreferredWidth(100);
tableForFileAFolderOverview.getColumnModel().getColumn(1)
.setMaxWidth(999);
tableForFileAFolderOverview.getColumnModel().getColumn(5)
.setPreferredWidth(100);
tableForFileAFolderOverview.getColumnModel().getColumn(5)
.setMaxWidth(999);
tableForFileAFolderOverview.getColumnModel().getColumn(6)
.setPreferredWidth(100);
tableForFileAFolderOverview.getColumnModel().getColumn(6)
.setMaxWidth(999);
Einlesen des Vectors
Java:
public void fillUpTableForOverview() {
ArrayList<Vector<Object>> forDataTransfer = new ArrayList<Vector<Object>>();
int counter = 0;
for (TableForFileAFolderOverviewStructur data : mainGui.tableArrayListForFileAFolderOverview) {
forDataTransfer.add(new Vector<Object>());
// 0
forDataTransfer.get(counter).add(data.XY1);
// 1
forDataTransfer.get(counter).add(data.XY2);
// 2
forDataTransfer.get(counter).add(data.XY3);
// 3
forDataTransfer.get(counter).add(data.XY4);
// 4
forDataTransfer.get(counter).add(data.XY5);
// 5
forDataTransfer.get(counter).add(data.canRead);
// 6
forDataTransfer.get(counter).add(data.canWrite);
counter++;
}
mainGui.tableForFileAFolderOverviewDatabase.addAll(forDataTransfer);
mainGui.tableForFileAFolderOverview.repaint();
mainGui.tableForFileAFolderOverview.revalidate();
}
Problem:
Das automatische Ändern von Daten geht ohne Fehlermeldung, nur über der GUI nicht.
Ist die Option für JTable sortieren ausgewählt und ich wähle über die GUI über JTabl einen Boolean wert aus, so bekomme ich den Fehler:
Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException: Invalid range
at javax.swing.DefaultRowSorter.rowsUpdated(Unknown Source)
at javax.swing.DefaultRowSorter.rowsUpdated(Unknown Source)
at javax.swing.JTable.notifySorter(Unknown Source)
at javax.swing.JTable.sortedTableChanged(Unknown Source)
at javax.swing.JTable.tableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableChanged(Unknown Source)
at javax.swing.table.AbstractTableModel.fireTableCellUpdated(Unknown Source)
at javax.swing.table.DefaultTableModel.setValueAt(Unknown Source)
at javax.swing.JTable.setValueAt(Unknown Source)
at javax.swing.JTable.editingStopped(Unknown Source)
at javax.swing.AbstractCellEditor.fireEditingStopped(Unknown Source)
at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(Unknown Source)
at javax.swing.DefaultCellEditor.stopCellEditing(Unknown Source)
at javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.repostEvent(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Frage:
1. Liegt es an den Vector?
Danke
Zuletzt bearbeitet: