Changeset 8205 in josm


Ignore:
Timestamp:
2015-04-17T22:31:30+02:00 (9 years ago)
Author:
simon04
Message:

fix #10790 - Display shortcuts in adding tags dialog

File:
1 edited

Legend:

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

    r7937 r8205  
    77import java.awt.BorderLayout;
    88import java.awt.Component;
     9import java.awt.Container;
    910import java.awt.Cursor;
    1011import java.awt.Dimension;
     
    7778import org.openstreetmap.josm.tools.GBC;
    7879import org.openstreetmap.josm.tools.Shortcut;
     80import org.openstreetmap.josm.tools.Utils;
    7981import org.openstreetmap.josm.tools.WindowGeometry;
    8082
     
    632634            rememberLastTags.setState(PROPERTY_REMEMBER_TAGS.get());
    633635            popupMenu.add(rememberLastTags);
     636        }
     637
     638        @Override
     639        public void setContentPane(Container contentPane) {
     640            final String text = "<html>" + Utils.join("<br>", Arrays.asList(
     641                    tr("<code>Ctrl-1</code> to apply first suggestion"),
     642                    tr("<code>Shift-Enter</code> to add without closing the dialog"),
     643                    tr("<code>Shift-Ctrl-1</code> to add first suggestion without closing the dialog")
     644            ));
     645            final JLabel helpLabel = new JLabel(text);
     646            helpLabel.setFont(helpLabel.getFont().deriveFont(Font.PLAIN));
     647            contentPane.add(helpLabel, GBC.eol().insets(1, 2, 1, 2));
     648            super.setContentPane(contentPane);
    634649        }
    635650
     
    710725                final String color = action.isEnabled() ? "" : "; color:gray";
    711726                final JLabel tagLabel = new JLabel("<html>"
    712                     + "<style>td{border:1px solid gray; font-weight:normal"+color+"}</style>"
    713                     + "<table><tr><td>" + XmlWriter.encode(t.toString(), true) + "</td></tr></table></html>");
     727                        + "<style>td{" + color + "}</style>"
     728                        + "<table><tr>"
     729                        + "<td>" + count + ".</td>"
     730                        + "<td style='border:1px solid gray'>" + XmlWriter.encode(t.toString(), true) + "<" +
     731                        "/td></tr></table></html>");
     732                tagLabel.setFont(tagLabel.getFont().deriveFont(Font.PLAIN));
    714733                if (action.isEnabled()) {
    715734                    // Register action
Note: See TracChangeset for help on using the changeset viewer.