- Timestamp:
- 2014-03-27T23:07:34+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/GettingStarted.java
r6897 r6935 57 57 setOpaque(false); 58 58 addHyperlinkListener(this); 59 adaptForNimbus(this); 59 60 } 60 61 -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmEditorPane.java
r6932 r6935 2 2 package org.openstreetmap.josm.gui.widgets; 3 3 4 import java.awt.Color; 4 5 import java.awt.Font; 5 6 import java.io.IOException; … … 10 11 11 12 import javax.swing.JEditorPane; 13 import javax.swing.LookAndFeel; 14 import javax.swing.UIDefaults; 12 15 import javax.swing.UIManager; 13 16 import javax.swing.text.html.StyleSheet; … … 80 83 return result; 81 84 } 82 85 83 86 /** 84 * Adapts a n{@link JEditorPane} to be used as a powerful replacement of {@link javax.swing.JLabel}.87 * Adapts a {@link JEditorPane} to be used as a powerful replacement of {@link javax.swing.JLabel}. 85 88 * @param pane The editor pane to adapt 86 89 * @param allBold If {@code true}, makes all text to be displayed in bold … … 90 93 pane.setOpaque(false); 91 94 pane.setEditable(false); 95 adaptForNimbus(pane); 92 96 93 97 JosmHTMLEditorKit kit = new JosmHTMLEditorKit(); … … 103 107 } 104 108 109 /** 110 * Adapts a {@link JEditorPane} for Nimbus look and feel. 111 * See <a href="https://stackoverflow.com/q/15228336/2257172">this StackOverflow question</a>. 112 * @param pane The editor pane to adapt 113 * @since 6935 114 */ 115 public static void adaptForNimbus(JEditorPane pane) { 116 LookAndFeel currentLAF = UIManager.getLookAndFeel(); 117 if (currentLAF != null && "Nimbus".equals(currentLAF.getName())) { 118 Color bgColor = UIManager.getColor("Label.background"); 119 UIDefaults defaults = new UIDefaults(); 120 defaults.put("EditorPane[Enabled].backgroundPainter", bgColor); 121 pane.putClientProperty("Nimbus.Overrides", defaults); 122 pane.putClientProperty("Nimbus.Overrides.InheritDefaults", true); 123 pane.setBackground(bgColor); 124 } 125 } 126 105 127 private static String getFontRule(Font f) { 106 128 return MessageFormat.format(
Note:
See TracChangeset
for help on using the changeset viewer.