Browse Source

Fix inconsistent fonts in the about dialog license and informations panels

tags/0.6.3m1rc1
Gregory Holmes 15 years ago
parent
commit
75c0931867

+ 12
- 1
src/com/dmdirc/addons/ui_swing/dialogs/about/InfoPanel.java View File

@@ -28,11 +28,15 @@ import com.dmdirc.addons.ui_swing.SwingController;
28 28
 import com.dmdirc.addons.ui_swing.UIUtilities;
29 29
 
30 30
 
31
+import java.awt.Font;
31 32
 import javax.swing.JEditorPane;
32 33
 import javax.swing.JPanel;
33 34
 import javax.swing.JScrollPane;
34 35
 import javax.swing.SwingUtilities;
35 36
 
37
+import javax.swing.UIManager;
38
+import javax.swing.text.html.HTMLDocument;
39
+import javax.swing.text.html.HTMLEditorKit;
36 40
 import net.miginfocom.swing.MigLayout;
37 41
 
38 42
 /** Info panel. */
@@ -56,7 +60,14 @@ public final class InfoPanel extends JPanel {
56 60
     /** Initialises the components. */
57 61
     private void initComponents() {
58 62
         final JScrollPane scrollPane = new JScrollPane();
59
-        final JEditorPane infoPane = new JEditorPane("text/html", "<html>" +
63
+        final JEditorPane infoPane = new JEditorPane();
64
+        infoPane.setEditorKit(new HTMLEditorKit());
65
+        final Font font = UIManager.getFont("Label.font");
66
+        ((HTMLDocument) infoPane.getDocument()).getStyleSheet().addRule("body " +
67
+                "{ font-family: " + font.getFamily() + "; " + "font-size: " +
68
+                font.getSize() + "pt; }");
69
+        
70
+         infoPane.setText("<html>" +
60 71
                 "<b>DMDirc version: </b>" + Info.getDMDircVersion() + "<br>" +
61 72
                 "<b>Profile directory: </b>" + Main.getConfigDir() + "<br>" +
62 73
                 "<b>Java version: </b>" + Info.getJavaVersion() + "<br>" +

+ 10
- 7
src/com/dmdirc/addons/ui_swing/dialogs/about/LicensePanel.java View File

@@ -25,6 +25,7 @@ package com.dmdirc.addons.ui_swing.dialogs.about;
25 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26 26
 import com.dmdirc.util.resourcemanager.ResourceManager;
27 27
 
28
+import java.awt.Font;
28 29
 import java.io.BufferedReader;
29 30
 import java.io.IOException;
30 31
 import java.io.InputStream;
@@ -39,6 +40,8 @@ import javax.swing.JScrollPane;
39 40
 import javax.swing.SwingUtilities;
40 41
 import javax.swing.UIManager;
41 42
 
43
+import javax.swing.text.html.HTMLDocument;
44
+import javax.swing.text.html.HTMLEditorKit;
42 45
 import net.miginfocom.swing.MigLayout;
43 46
 
44 47
 /**
@@ -70,14 +73,14 @@ public final class LicensePanel extends JPanel {
70 73
                 getResourcesStartingWithAsInputStreams("com/dmdirc/licenses/"));
71 74
 
72 75
         license = new JEditorPane();
73
-        license.setContentType("text/html");
76
+        license.setEditorKit(new HTMLEditorKit());
77
+        final Font font = UIManager.getFont("Label.font");
78
+        ((HTMLDocument) license.getDocument()).getStyleSheet().addRule("body " +
79
+                "{ font-family: " + font.getFamily() + "; " + "font-size: " +
80
+                font.getSize() + "pt; }");
81
+        
74 82
         final StringBuilder licenseText = new StringBuilder();
75 83
         licenseText.append("<html>");
76
-        licenseText.append("<span style='font-family: ");
77
-        licenseText.append(UIManager.getFont("TextField.font").getFamily());
78
-        licenseText.append("; font-size:");
79
-        licenseText.append(UIManager.getFont("TextField.font").getSize());
80
-        licenseText.append("pt;'>");
81 84
         licenseText.append("Below are the licenses used in various components of DMDirc: <br><ul>");
82 85
         for (Entry<String, InputStream> entry : licenses.entrySet()) {
83 86
             final String licenseString = entry.getKey().substring(entry.getKey().
@@ -101,7 +104,7 @@ public final class LicensePanel extends JPanel {
101 104
                         "<br>"));
102 105
             }
103 106
         }
104
-        licenseText.append("</span></html>");
107
+        licenseText.append("</html>");
105 108
         license.setText(licenseText.toString());
106 109
         license.setEditable(false);
107 110
 

+ 0
- 1
src/com/dmdirc/installer/ui/TitlePanel.java View File

@@ -28,7 +28,6 @@ import com.dmdirc.installer.ui.EtchedLineBorder.BorderSide;
28 28
 import java.awt.BorderLayout;
29 29
 import java.awt.Color;
30 30
 
31
-import java.awt.Font;
32 31
 import java.awt.Toolkit;
33 32
 import javax.swing.ImageIcon;
34 33
 import javax.swing.JLabel;

Loading…
Cancel
Save