Ignore:
Timestamp:
2014-05-17T04:49:16+02:00 (10 years ago)
Author:
simon04
Message:

Display numbers in map status line according to locale/language

File:
1 edited

Legend:

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

    r7005 r7135  
    2727import java.awt.event.MouseMotionListener;
    2828import java.lang.reflect.InvocationTargetException;
     29import java.text.DecimalFormat;
    2930import java.util.ArrayList;
    3031import java.util.Collection;
     
    8586 */
    8687public class MapStatus extends JPanel implements Helpful, Destroyable, PreferenceChangedListener {
     88
     89    private static final DecimalFormat ONE_DECIMAL_PLACE = new DecimalFormat("0.0");
    8790
    8891    /**
     
    723726       
    724727        private final JSeparator separator = new JSeparator();
    725        
     728
    726729        private final JMenuItem doNotHide = new JCheckBoxMenuItem(new AbstractAction(tr("Do not hide status bar")) {
    727730            @Override
     
    743746                add(item);
    744747            }
    745            
     748
    746749            add(separator);
    747750            add(doNotHide);
    748            
     751
    749752            addPopupMenuListener(new PopupMenuListener() {
    750753                @Override
     
    947950
    948951    public void setAngle(double a) {
    949         angleText.setText(a < 0 ? "--" : Math.round(a*10)/10.0 + " \u00B0");
     952        angleText.setText(a < 0 ? "--" : ONE_DECIMAL_PLACE.format(a) + " \u00B0");
    950953    }
    951954
    952955    public void setHeading(double h) {
    953         headingText.setText(h < 0 ? "--" : Math.round(h*10)/10.0 + " \u00B0");
     956        headingText.setText(h < 0 ? "--" : ONE_DECIMAL_PLACE.format(h) + " \u00B0");
    954957    }
    955958
     
    960963    public void setDist(double dist) {
    961964        distValue = dist;
    962         distText.setText(dist < 0 ? "--" : NavigatableComponent.getDistText(dist));
     965        distText.setText(dist < 0 ? "--" : NavigatableComponent.getDistText(dist, ONE_DECIMAL_PLACE, 0.01));
    963966    }
    964967
Note: See TracChangeset for help on using the changeset viewer.