Changeset 10053 in josm


Ignore:
Timestamp:
2016-03-26T22:47:13+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #12628 - Ability to copy coordinates from History dialog

File:
1 edited

Legend:

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

    r9982 r10053  
    1313import javax.swing.JLabel;
    1414import javax.swing.JPanel;
     15import javax.swing.UIManager;
    1516
    1617import org.openstreetmap.gui.jmapviewer.JMapViewer;
     
    2223import org.openstreetmap.josm.gui.NavigatableComponent;
    2324import org.openstreetmap.josm.gui.util.GuiHelper;
     25import org.openstreetmap.josm.gui.widgets.JosmTextArea;
    2426import org.openstreetmap.josm.tools.CheckParameterUtil;
    2527import org.openstreetmap.josm.tools.Pair;
     
    189191    }
    190192
     193    private static JosmTextArea newTextArea() {
     194        JosmTextArea area = new JosmTextArea();
     195        GuiHelper.setBackgroundReadable(area, Color.WHITE);
     196        area.setEditable(false);
     197        area.setOpaque(true);
     198        area.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
     199        area.setFont(UIManager.getFont("Label.font"));
     200        return area;
     201    }
     202
    191203    private static class Updater {
    192204        private final HistoryBrowserModel model;
     
    220232            return Pair.create(node.getCoords(), oppositeNode.getCoords());
    221233        }
    222 
    223234    }
    224235
    225236    /**
    226      * A UI widgets which displays the Lan/Lon-coordinates of a
    227      * {@link HistoryNode}.
    228      *
     237     * A UI widgets which displays the Lan/Lon-coordinates of a {@link HistoryNode}.
    229238     */
    230239    private static class LatLonViewer extends JPanel implements Observer {
    231240
    232         private JLabel lblLat;
    233         private JLabel lblLon;
     241        private final JosmTextArea lblLat = newTextArea();
     242        private final JosmTextArea lblLon = newTextArea();
    234243        private final Updater updater;
    235244        private final Color modifiedColor;
     
    254263            gc.fill = GridBagConstraints.HORIZONTAL;
    255264            gc.weightx = 1.0;
    256             add(lblLat = new JLabel(), gc);
    257             GuiHelper.setBackgroundReadable(lblLat, Color.WHITE);
    258             lblLat.setOpaque(true);
    259             lblLat.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
     265            add(lblLat, gc);
    260266
    261267            // --------
     
    272278            gc.fill = GridBagConstraints.HORIZONTAL;
    273279            gc.weightx = 1.0;
    274             add(lblLon = new JLabel(), gc);
    275             GuiHelper.setBackgroundReadable(lblLon, Color.WHITE);
    276             lblLon.setOpaque(true);
    277             lblLon.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
     280            add(lblLon, gc);
    278281        }
    279282
    280283        /**
    281          *
     284         * Constrcuts a new {@code LatLonViewer}.
    282285         * @param model a model
    283286         * @param role the role for this viewer.
     
    357360    private static class DistanceViewer extends JPanel implements Observer {
    358361
    359         private JLabel lblDistance;
     362        private final JosmTextArea lblDistance = newTextArea();
    360363        private final Updater updater;
    361364
     
    384387            gc.fill = GridBagConstraints.HORIZONTAL;
    385388            gc.weightx = 1.0;
    386             add(lblDistance = new JLabel(), gc);
    387             GuiHelper.setBackgroundReadable(lblDistance, Color.WHITE);
    388             lblDistance.setOpaque(true);
    389             lblDistance.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
     389            add(lblDistance, gc);
    390390        }
    391391
Note: See TracChangeset for help on using the changeset viewer.