Changeset 6808 in josm for trunk/src


Ignore:
Timestamp:
2014-02-04T00:21:44+01:00 (6 years ago)
Author:
Don-vip
Message:

fix #9675 - allow resize of "add tag" dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r6700 r6808  
    414414        @Override
    415415        public void setupDialog() {
    416             setResizable(false);
    417416            super.setupDialog();
     417            final Dimension size = getSize();
     418            // Set resizable only in width
     419            setMinimumSize(size);
     420            setPreferredSize(size);
     421            // setMaximumSize does not work, and never worked, but still it seems not to bother Oracle to fix this 10-year-old bug
     422            // https://bugs.openjdk.java.net/browse/JDK-6200438
     423            // https://bugs.openjdk.java.net/browse/JDK-6464548
    418424           
    419425            setRememberWindowGeometry(getClass().getName() + ".geometry",
    420                 WindowGeometry.centerInWindow(Main.parent, getSize()));
     426                WindowGeometry.centerInWindow(Main.parent, size));
    421427        }
    422428
    423429        @Override
    424430        public void setVisible(boolean visible) {
    425             // Do not want dialog to be resizable, but its size may increase each time because of the recently added tags
     431            // Do not want dialog to be resizable in height, as its size may increase each time because of the recently added tags
    426432            // So need to modify the stored geometry (size part only) in order to use the automatic positioning mechanism
    427433            if (visible) {
    428434                WindowGeometry geometry = initWindowGeometry();
    429435                Dimension storedSize = geometry.getSize();
    430                 if (!storedSize.equals(getSize())) {
    431                     storedSize.setSize(getSize());
     436                Dimension size = getSize();
     437                if (!storedSize.equals(size)) {
     438                    if (storedSize.width < size.width) {
     439                        storedSize.width = size.width;
     440                    }
     441                    if (storedSize.height != size.height) {
     442                        storedSize.height = size.height;
     443                    }
    432444                    rememberWindowGeometry(geometry);
    433445                }
     
    617629            }
    618630            JOptionPane.showMessageDialog(this, tr("Please enter integer number between 0 and {0}", MAX_LRU_TAGS_NUMBER));
    619            
    620631        }
    621632       
     
    757768            }
    758769        }
    759 
    760770    }
    761771 }
Note: See TracChangeset for help on using the changeset viewer.