F
Felix Natter
hi,
I have a special table setup in order to get fixed header and footer
rows and a scrollable middle part: Three JTable (header, data, footer)
in a vertical BoxLayout which share a common TableColumnModel.
Now I have two problems with this:
1. resizing doesn't always work (probably related to 2.)
2. the model's getValueAt method is constantly being called, even
if nothing in the JTable, not even the view, changes. This causes
really high CPU load. This does not occur when I comment out the header
and footer JTables.
My setup is like this (Alignment means "data"):
dataModel = new AlignmentDataModel(gs.getAlignment());
columnModel = new AlignmentColumnModel(gs.getAlignment());
columnModel.setColumnSelectionAllowed(false);
headerTable = new JTable(new AlignmentHeaderFooterDataModel(), columnModel);
headerTable.setVisible(true);
headerTable.setRowHeight(22);
headerTable.setRowSelectionAllowed(false);
headerTable.setColumnSelectionAllowed(false);
headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable = new JTable(dataModel, columnModel);
// create columns and call alignmentTable.addColumn(col)
// ...
alignmentTable.setVisible(true);
// java6... alignmentTable.setFillsViewportHeight(true);
alignmentTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable.setRowHeight(22);
alignmentTable.setRowSelectionAllowed(false);
alignmentTable.setColumnSelectionAllowed(false);
footerTable = new JTable(new AlignmentHeaderFooterDataModel(), columnModel);
footerTable.setVisible(true);
footerTable.setRowHeight(22);
footerTable.setRowSelectionAllowed(false);
footerTable.setColumnSelectionAllowed(false);
footerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable.setAutoCreateRowSorter(true);
Do you have any idea what could be causing this? The multiple JTables
with a common TableColumnModel seems to be a standard solution...
Thanks in advance!
I have a special table setup in order to get fixed header and footer
rows and a scrollable middle part: Three JTable (header, data, footer)
in a vertical BoxLayout which share a common TableColumnModel.
Now I have two problems with this:
1. resizing doesn't always work (probably related to 2.)
2. the model's getValueAt method is constantly being called, even
if nothing in the JTable, not even the view, changes. This causes
really high CPU load. This does not occur when I comment out the header
and footer JTables.
My setup is like this (Alignment means "data"):
dataModel = new AlignmentDataModel(gs.getAlignment());
columnModel = new AlignmentColumnModel(gs.getAlignment());
columnModel.setColumnSelectionAllowed(false);
headerTable = new JTable(new AlignmentHeaderFooterDataModel(), columnModel);
headerTable.setVisible(true);
headerTable.setRowHeight(22);
headerTable.setRowSelectionAllowed(false);
headerTable.setColumnSelectionAllowed(false);
headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable = new JTable(dataModel, columnModel);
// create columns and call alignmentTable.addColumn(col)
// ...
alignmentTable.setVisible(true);
// java6... alignmentTable.setFillsViewportHeight(true);
alignmentTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable.setRowHeight(22);
alignmentTable.setRowSelectionAllowed(false);
alignmentTable.setColumnSelectionAllowed(false);
footerTable = new JTable(new AlignmentHeaderFooterDataModel(), columnModel);
footerTable.setVisible(true);
footerTable.setRowHeight(22);
footerTable.setRowSelectionAllowed(false);
footerTable.setColumnSelectionAllowed(false);
footerTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
alignmentTable.setAutoCreateRowSorter(true);
Do you have any idea what could be causing this? The multiple JTables
with a common TableColumnModel seems to be a standard solution...
Thanks in advance!