Ignore:
Timestamp:
2017-10-19T00:19:04+02:00 (7 years ago)
Author:
donvip
Message:

fix #josm10261 - use JOSM date formatting system

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/infomode/src/org/openstreetmap/josm/plugins/infomode/InfoPanel.java

    r33720 r33721  
    1212import java.util.Collection;
    1313import java.util.HashSet;
    14 import java.util.Locale;
    1514import java.util.Set;
    1615
     
    2726import org.openstreetmap.josm.tools.Logging;
    2827import org.openstreetmap.josm.tools.OpenBrowser;
     28import org.openstreetmap.josm.tools.date.DateUtils;
    2929
    3030class InfoPanel extends JPanel {
     
    3232    private Collection<GpxTrack> tracks;
    3333    private GpxTrack trk;
    34     private DateFormat df;
    3534
    3635    private JLabel label1 = new JLabel();
     
    4544    InfoPanel() {
    4645        super(new GridBagLayout());
    47         df = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.getDefault());
    4846        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    4947        add(label1, GBC.eol().insets(10, 0, 0, 0));
     
    110108            but2.setVisible(false);
    111109        } else {
    112             label1.setText(df.format(wp.getTime()));
     110            label1.setText(DateUtils.formatDateTime(wp.getTime(), DateFormat.DEFAULT, DateFormat.DEFAULT));
    113111            but2.setVisible(true);
    114112        }
     
    123121        s = (String) wp.attr.get("ele");
    124122        String s1 = "";
    125         try {
    126             s1 = String.format("H=%3.1f   ", Double.parseDouble(s));
    127         } catch (Exception e) {
    128             Logging.warn(e);
     123        if (s != null) {
     124            try {
     125                s1 = String.format("H=%3.1f   ", Double.parseDouble(s));
     126            } catch (NumberFormatException e) {
     127                Logging.warn(e);
     128            }
    129129        }
    130130        s1 = s1+"L="+(int) trk.length();
Note: See TracChangeset for help on using the changeset viewer.