Ticket #18429: 18429.fix_auto.patch

File 18429.fix_auto.patch, 1.3 KB (added by taylor.smock, 4 years ago)

Adds an ancestor listener that listens for the ancestorAdded call.

  • src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

     
    2323import javax.swing.JEditorPane;
    2424import javax.swing.JLabel;
    2525import javax.swing.JPanel;
     26import javax.swing.event.AncestorEvent;
     27import javax.swing.event.AncestorListener;
    2628import javax.swing.event.ChangeEvent;
    2729import javax.swing.event.ChangeListener;
    2830import javax.swing.event.HyperlinkEvent;
     
    115117        if (obtainSourceAutomatically.isSelected()) {
    116118            automaticallyAddSource();
    117119        }
     120        pnl.addAncestorListener(new AncestorListener() {
     121            @Override
     122            public void ancestorAdded(AncestorEvent event) {
     123                if (obtainSourceAutomatically.isSelected())
     124                    automaticallyAddSource();
     125            }
     126
     127            @Override
     128            public void ancestorRemoved(AncestorEvent event) {
     129                // Do nothing
     130            }
     131
     132            @Override
     133            public void ancestorMoved(AncestorEvent event) {
     134                // Do nothing
     135            }
     136
     137        });
    118138        return pnl;
    119139    }
    120140