Changeset 17705 in josm for trunk/src/org


Ignore:
Timestamp:
2021-04-07T20:43:28+02:00 (4 years ago)
Author:
simon04
Message:

see #19126 - Simplify WindowGeometry code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/util/WindowGeometry.java

    r17704 r17705  
    1414import java.awt.Rectangle;
    1515import java.awt.Window;
     16import java.util.Locale;
    1617import java.util.Objects;
    1718import java.util.regex.Matcher;
     
    279280     */
    280281    public void remember(String preferenceKey) {
    281         StringBuilder value = new StringBuilder(32);
    282         value.append("x=").append(topLeft.x).append(",y=").append(topLeft.y)
    283              .append(",width=").append(extent.width).append(",height=").append(extent.height);
    284         Config.getPref().put(preferenceKey, value.toString());
     282        String value = String.format(Locale.ROOT, "x=%d,y=%d,width=%d,height=%d", topLeft.x, topLeft.y, extent.width, extent.height);
     283        Config.getPref().put(preferenceKey, value);
    285284    }
    286285
     
    507506            return false;
    508507        WindowGeometry other = (WindowGeometry) obj;
    509         if (extent == null) {
    510             if (other.extent != null)
    511                 return false;
    512         } else if (!extent.equals(other.extent))
    513             return false;
    514         if (topLeft == null) {
    515             if (other.topLeft != null)
    516                 return false;
    517         } else if (!topLeft.equals(other.topLeft))
    518             return false;
    519         return true;
     508        return Objects.equals(extent, other.extent) && Objects.equals(topLeft, other.topLeft);
    520509    }
    521510
Note: See TracChangeset for help on using the changeset viewer.