Changeset 15774 in josm for trunk


Ignore:
Timestamp:
2020-01-26T18:26:24+01:00 (5 years ago)
Author:
simon04
Message:

Simplify RelationMemberListViewer.buildTable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java

    r15772 r15774  
    66import javax.swing.JTable;
    77import javax.swing.ListSelectionModel;
    8 import javax.swing.event.TableModelEvent;
    9 import javax.swing.event.TableModelListener;
    108
    119/**
     
    2119public class RelationMemberListViewer extends HistoryViewerPanel {
    2220
    23     protected static class MemberModelChanged implements TableModelListener {
    24         private final JTable table;
    25 
    26         protected MemberModelChanged(JTable table) {
    27             this.table = table;
    28         }
    29 
    30         @Override
    31         public void tableChanged(TableModelEvent e) {
    32             Rectangle rect = table.getCellRect(((DiffTableModel) e.getSource()).getFirstChange(), 0, true);
    33             table.scrollRectToVisible(rect);
    34         }
    35     }
    36 
    3721    @Override
    3822    protected JTable buildTable(PointInTimeType pointInTimeType) {
     
    4226        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    4327        selectionSynchronizer.participateInSynchronizedSelection(table.getSelectionModel());
    44         table.getModel().addTableModelListener(new MemberModelChanged(table));
     28        table.getModel().addTableModelListener(e -> {
     29            Rectangle rect = table.getCellRect(((DiffTableModel) e.getSource()).getFirstChange(), 0, true);
     30            table.scrollRectToVisible(rect);
     31        });
    4532        return table;
    4633    }
Note: See TracChangeset for help on using the changeset viewer.