Changeset 6901 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2014-03-07T11:35:00+01:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java
r6889 r6901 13 13 14 14 import javax.swing.ButtonGroup; 15 import javax.swing.JLabel;16 15 import javax.swing.JOptionPane; 17 16 import javax.swing.JPanel; … … 19 18 20 19 import org.openstreetmap.josm.Main; 20 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 21 21 import org.openstreetmap.josm.tools.GBC; 22 22 import org.openstreetmap.josm.tools.Utils; … … 271 271 add((Component) message, GBC.eop()); 272 272 } else if (message != null) { 273 add(new J Label(message.toString()), GBC.eop());273 add(new JMultilineLabel(message.toString()), GBC.eop()); 274 274 } 275 275 add(cbShowPermanentDialog, GBC.eol()); -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r6889 r6901 65 65 66 66 // Add the name of this application 67 JLabel caption = new JLabel("JOSM -" + tr("Java OpenStreetMap Editor"));67 JLabel caption = new JLabel("JOSM – " + tr("Java OpenStreetMap Editor")); 68 68 caption.setFont(GuiHelper.getTitleFont()); 69 69 gbc.gridheight = 1; … … 107 107 } 108 108 109 /** 110 * Returns the progress monitor. 111 * @return The progress monitor 112 */ 109 113 public ProgressMonitor getProgressMonitor() { 110 114 return progressMonitor; -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r6660 r6901 29 29 import org.openstreetmap.josm.data.osm.Changeset; 30 30 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; 31 import org.openstreetmap.josm.gui.widgets.J osmEditorPane;31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 32 32 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 33 import org.openstreetmap.josm.tools.GBC; … … 56 56 JPanel pnl = new JPanel(new GridBagLayout()); 57 57 58 final JEditorPane commentLabel = JosmEditorPane.createJLabelLikePane(); 59 commentLabel.setText("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 58 final JEditorPane commentLabel = new JMultilineLabel("<html><b>" + tr("Provide a brief comment for the changes you are uploading:")); 60 59 pnl.add(commentLabel, GBC.eol().insets(0, 5, 10, 3).fill(GBC.HORIZONTAL)); 61 60 hcbUploadComment.setToolTipText(tr("Enter an upload comment")); … … 69 68 pnl.add(hcbUploadComment, GBC.eol().fill(GBC.HORIZONTAL)); 70 69 71 final JEditorPane sourceLabel = JosmEditorPane.createJLabelLikePane(); 72 sourceLabel.setText("<html><b>" + tr("Specify the data source for the changes") 70 final JEditorPane sourceLabel = new JMultilineLabel("<html><b>" + tr("Specify the data source for the changes") 73 71 + "</b> (<a href=\"urn:changeset-source\">" + tr("obtain from current layers") + "</a>)<b>:</b>"); 74 72 sourceLabel.addHyperlinkListener(new HyperlinkListener() { -
trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
r6822 r6901 16 16 17 17 import org.openstreetmap.josm.data.osm.Changeset; 18 import org.openstreetmap.josm.gui.widgets.J osmEditorPane;18 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 19 19 import org.openstreetmap.josm.io.OsmApi; 20 20 import org.openstreetmap.josm.tools.ImageProvider; … … 24 24 private UploadStrategySpecification spec = new UploadStrategySpecification(); 25 25 private int numObjects; 26 private J osmEditorPanejepMessage;26 private JMultilineLabel jepMessage; 27 27 private JLabel lblWarning; 28 28 … … 99 99 100 100 protected void build() { 101 jepMessage = JosmEditorPane.createJLabelLikePane();101 jepMessage = new JMultilineLabel(""); 102 102 jepMessage.addHyperlinkListener(this); 103 103 -
trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java
r6889 r6901 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.io; 3 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 4 5 import static org.openstreetmap.josm.tools.I18n.trn; … … 30 31 31 32 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.io.OsmApi;33 import org.openstreetmap.josm.tools.ImageProvider;34 33 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; 35 34 import org.openstreetmap.josm.gui.widgets.JosmTextField; 35 import org.openstreetmap.josm.io.OsmApi; 36 36 37 37 /** … … 108 108 gc.weighty = 0.0; 109 109 gc.gridwidth = 2; 110 J Label lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);110 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 111 111 lbl.setText(tr("Upload data in one request")); 112 112 pnl.add(lbl, gc); … … 320 320 if (maxChunkSize > 0 && numUploadedObjects > maxChunkSize) { 321 321 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(false); 322 JLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 323 lbl.setIcon(ImageProvider.get("warning-small.png")); 322 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 324 323 lbl.setText(tr("Upload in one request not possible (too many objects to upload)")); 325 324 lbl.setToolTipText(tr("<html>Cannot upload {0} objects in one request because the<br>" … … 341 340 } else { 342 341 rbStrategy.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setEnabled(true); 343 J Label lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY);342 JMultilineLabel lbl = lblStrategies.get(UploadStrategy.SINGLE_REQUEST_STRATEGY); 344 343 lbl.setText(tr("Upload data in one request")); 345 lbl.setIcon(null);346 344 lbl.setToolTipText(""); 347 345 lblNumRequests.get(UploadStrategy.SINGLE_REQUEST_STRATEGY).setVisible(true); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r6890 r6901 189 189 gc.fill = GridBagConstraints.HORIZONTAL; 190 190 gc.weightx = 1.0; 191 J Label lbl;191 JMultilineLabel lbl; 192 192 add(lbl = new JMultilineLabel(tr("You do not have an Access Token yet to access the OSM server using OAuth. Please authorize first.")), gc); 193 193 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); … … 228 228 gc.weightx = 1.0; 229 229 gc.gridwidth = 2; 230 J Label lbl;230 JMultilineLabel lbl; 231 231 add(lbl = new JMultilineLabel(tr("You already have an Access Token to access the OSM server using OAuth.")), gc); 232 232 lbl.setFont(lbl.getFont().deriveFont(Font.PLAIN)); -
trunk/src/org/openstreetmap/josm/gui/widgets/JMultilineLabel.java
r6365 r6901 5 5 import java.awt.Rectangle; 6 6 7 import javax.swing.J Label;7 import javax.swing.JEditorPane; 8 8 import javax.swing.plaf.basic.BasicHTML; 9 9 import javax.swing.text.View; … … 16 16 * Note that this won't work if JMultilineLabel is put into a JScrollBox or 17 17 * similar as the bounds will never change. Instead scrollbars will be displayed. 18 * 18 * 19 19 * @since 6340 20 20 */ 21 public class JMultilineLabel extends J Label{21 public class JMultilineLabel extends JEditorPane { 22 22 private int maxWidth = Integer.MAX_VALUE; 23 23 private Rectangle oldbounds = null; … … 33 33 */ 34 34 public JMultilineLabel(String text) { 35 super(); 35 this(text, true); 36 } 37 38 public JMultilineLabel(String text, boolean allBold) { 39 JosmEditorPane.makeJLabelLike(this, allBold); 36 40 String html = text.trim().replaceAll("\n", "<br>"); 37 41 if (!html.startsWith("<html>")) { -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java
r6654 r6901 13 13 import javax.swing.text.html.StyleSheet; 14 14 15 import org.openstreetmap.josm.gui.util.GuiHelper; 15 16 import org.openstreetmap.josm.tools.Utils; 16 17 … … 81 82 82 83 /** 83 * Creates a {@link JosmEditorPane} which is meantto be used as a powerful replacement of {@link javax.swing.JLabel}.84 * Adapts an {@link JEditorPane} to be used as a powerful replacement of {@link javax.swing.JLabel}. 84 85 */ 85 public static JosmEditorPane createJLabelLikePane() {86 final JosmEditorPane pane = new JosmEditorPane("text/html", "");86 public static void makeJLabelLike(JEditorPane pane, boolean allBold) { 87 pane.setContentType("text/html"); 87 88 pane.setOpaque(false); 88 89 pane.setEditable(false); … … 91 92 final Font f = UIManager.getFont("Label.font"); 92 93 final StyleSheet ss = new StyleSheet(); 93 final String rule = MessageFormat.format( 94 ss.addRule((allBold ? "html" : "strong, b") + " {" + getFontRule(f) + "}"); 95 ss.addRule("a {text-decoration: underline; color: blue}"); 96 ss.addRule("h1 {" + getFontRule(GuiHelper.getTitleFont()) + "}"); 97 kit.setStyleSheet(ss); 98 pane.setEditorKit(kit); 99 } 100 101 private static String getFontRule(Font f) { 102 return MessageFormat.format( 94 103 "font-family: ''{0}'';font-size: {1,number}pt; font-weight: {2}; font-style: {3}", 95 104 f.getName(), … … 98 107 f.isItalic() ? "italic" : "normal" 99 108 ); 100 ss.addRule("strong {" + rule + "}");101 ss.addRule("a {text-decoration: underline; color: blue}");102 kit.setStyleSheet(ss);103 pane.setEditorKit(kit);104 105 return pane;106 109 } 107 110 }
Note:
See TracChangeset
for help on using the changeset viewer.