Changeset 18603 in josm for trunk/src/org
- Timestamp:
- 2022-11-22T14:37:25+01:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r18208 r18603 152 152 this.availableSourcesModel = new AvailableSourcesModel(); 153 153 this.tblAvailableSources = new ScrollHackTable(availableSourcesModel); 154 // This add/remove listener code is needed to fix #20849. Java fires table listeners in the reverse order 155 // in which they were added, and we need the model to have been updated before we call the adjustColumnWidth code. 156 // So we remove the JTable and re-add it as a listener after we add the column width adjustment 157 availableSourcesModel.addTableModelListener(e -> TableHelper.adjustColumnWidth(tblAvailableSources, 0, 800)); 158 availableSourcesModel.removeTableModelListener(this.tblAvailableSources); 159 availableSourcesModel.addTableModelListener(this.tblAvailableSources); 154 160 this.tblAvailableSources.setAutoCreateRowSorter(true); 155 161 this.tblAvailableSources.setSelectionModel(selectionModel); … … 191 197 // Force Swing to show horizontal scrollbars for the JTable 192 198 // Yes, this is a little ugly, but should work 193 availableSourcesModel.addTableModelListener(e -> TableHelper.adjustColumnWidth(tblAvailableSources, 0, 800));194 199 activeSourcesModel.addTableModelListener(e -> TableHelper.adjustColumnWidth(tblActiveSources, canEnable ? 1 : 0, 800)); 195 200 activeSourcesModel.setActiveSources(getInitialSourcesList());
Note:
See TracChangeset
for help on using the changeset viewer.