Ticket #19819: JOSM-statusbar-foreground-fix.diff

File JOSM-statusbar-foreground-fix.diff, 2.2 KB (added by DevCharly, 6 years ago)

fix text color in status bar

  • src/org/openstreetmap/josm/gui/MapStatus.java

     
    909909        setLayout(new GridBagLayout());
    910910        setBorder(BorderFactory.createEmptyBorder(1, 2, 1, 2));
    911911
     912        latText.setForeground(PROP_FOREGROUND_COLOR.get());
     913        lonText.setForeground(PROP_FOREGROUND_COLOR.get());
     914        headingText.setForeground(PROP_FOREGROUND_COLOR.get());
     915        distText.setForeground(PROP_FOREGROUND_COLOR.get());
     916        nameText.setForeground(PROP_FOREGROUND_COLOR.get());
     917
    912918        latText.setInheritsPopupMenu(true);
    913919        lonText.setInheritsPopupMenu(true);
    914920        headingText.setInheritsPopupMenu(true);
     
    11541160    @Override
    11551161    public void preferenceChanged(PreferenceChangeEvent e) {
    11561162        String key = e.getKey();
    1157         if (key.startsWith("color.")) {
    1158             key = key.substring("color.".length());
     1163        if (key.startsWith(NamedColorProperty.NAMED_COLOR_PREFIX)) {
    11591164            if (PROP_BACKGROUND_COLOR.getKey().equals(key) || PROP_FOREGROUND_COLOR.getKey().equals(key)) {
    11601165                for (ImageLabel il : new ImageLabel[]{latText, lonText, headingText, distText, nameText}) {
    11611166                    il.setBackground(PROP_BACKGROUND_COLOR.get());
  • src/org/openstreetmap/josm/gui/widgets/ImageLabel.java

     
    5555        imgLabel.setIcon(ImageProvider.get("statusline/", img, ImageSizes.STATUSLINE));
    5656    }
    5757
     58    /**
     59     * Sets the foreground color of the text.
     60     * @param fg text color
     61     */
    5862    @Override
     63    public void setForeground(Color fg) {
     64        super.setForeground(fg);
     65        if (tf != null) {
     66            tf.setForeground(fg);
     67        }
     68    }
     69
     70    @Override
    5971    public Dimension getPreferredSize() {
    6072        return new Dimension(25 + charCount*tf.getFontMetrics(tf.getFont()).charWidth('0'), super.getPreferredSize().height);
    6173    }