Changeset 13777 in josm for trunk/src


Ignore:
Timestamp:
2018-05-16T21:30:47+02:00 (7 years ago)
Author:
wiktorn
Message:

Use setRememberWindowGeometry instead overriding setVisible

See: #16249

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryDialog.java

    r13774 r13777  
    1818public class AddImageryDialog extends ExtendedDialog implements ContentValidationListener {
    1919
    20     private final String saveGeometryEntryName;
    21 
    2220    /**
    2321     * Constructs a new AddImageryDialog.
     
    3331        setMinimumSize(new Dimension(300, 400));
    3432        panel.addContentValidationListener(this);
    35         this.saveGeometryEntryName = panel.getClass().getName() + ".geometry";
     33        setRememberWindowGeometry(
     34                panel.getClass().getName() + ".geometry",
     35                WindowGeometry.centerInWindow(Main.parent, new Dimension(400, 600))
     36                );
    3637    }
    3738
     
    4647        buttons.get(0).setEnabled(isValid);
    4748    }
    48 
    49     @Override
    50     public void setVisible(boolean visible) {
    51         if (visible) {
    52             new WindowGeometry(saveGeometryEntryName, WindowGeometry.centerInWindow(Main.parent,
    53                     new Dimension(800, 600))).applySafe(this);
    54         } else if (isShowing()) { // Avoid IllegalComponentStateException like in #8775
    55             new WindowGeometry(this).remember(saveGeometryEntryName);
    56         }
    57         super.setVisible(visible);
    58     }
    5949}
Note: See TracChangeset for help on using the changeset viewer.