|
@@ -28,6 +28,7 @@ import java.awt.Color;
|
28
|
28
|
import java.awt.Font;
|
29
|
29
|
import java.awt.Insets;
|
30
|
30
|
|
|
31
|
+import javax.annotation.Nullable;
|
31
|
32
|
import javax.swing.JTextPane;
|
32
|
33
|
import javax.swing.UIManager;
|
33
|
34
|
import javax.swing.plaf.basic.BasicTextPaneUI;
|
|
@@ -54,6 +55,9 @@ public class TextLabel extends JTextPane {
|
54
|
55
|
|
55
|
56
|
/**
|
56
|
57
|
* Creates a new instance of TextLabel.
|
|
58
|
+ *
|
|
59
|
+ * <p>Labels constructed without a {@link URLBuilder} will not be able to resolve
|
|
60
|
+ * DMDirc-specific URLs in image tags.
|
57
|
61
|
*/
|
58
|
62
|
public TextLabel() {
|
59
|
63
|
this(null, true);
|
|
@@ -62,6 +66,9 @@ public class TextLabel extends JTextPane {
|
62
|
66
|
/**
|
63
|
67
|
* Creates a new instance of TextLabel.
|
64
|
68
|
*
|
|
69
|
+ * <p>Labels constructed without a {@link URLBuilder} will not be able to resolve
|
|
70
|
+ * DMDirc-specific URLs in image tags.
|
|
71
|
+ *
|
65
|
72
|
* @param justified Justify the text?
|
66
|
73
|
*/
|
67
|
74
|
public TextLabel(final boolean justified) {
|
|
@@ -71,6 +78,9 @@ public class TextLabel extends JTextPane {
|
71
|
78
|
/**
|
72
|
79
|
* Creates a new instance of TextLabel.
|
73
|
80
|
*
|
|
81
|
+ * <p>Labels constructed without a {@link URLBuilder} will not be able to resolve
|
|
82
|
+ * DMDirc-specific URLs in image tags.
|
|
83
|
+ *
|
74
|
84
|
* @param text Text to display
|
75
|
85
|
*/
|
76
|
86
|
public TextLabel(final String text) {
|
|
@@ -80,12 +90,30 @@ public class TextLabel extends JTextPane {
|
80
|
90
|
/**
|
81
|
91
|
* Creates a new instance of TextLabel.
|
82
|
92
|
*
|
|
93
|
+ * <p>Labels constructed without a {@link URLBuilder} will not be able to resolve
|
|
94
|
+ * DMDirc-specific URLs in image tags.
|
|
95
|
+ *
|
83
|
96
|
* @param text Text to display
|
84
|
97
|
* @param justified Justify the text?
|
85
|
98
|
*/
|
86
|
99
|
public TextLabel(final String text, final boolean justified) {
|
|
100
|
+ this(null, text, justified);
|
|
101
|
+ }
|
|
102
|
+
|
|
103
|
+ /**
|
|
104
|
+ * Creates a new instance of TextLabel.
|
|
105
|
+ *
|
|
106
|
+ * @param urlBuilder The URL builder to use for embedded image URLs. If {@code null}, then only
|
|
107
|
+ * standard URLs will be handled in image tags (not DMDirc-specific ones).
|
|
108
|
+ * @param text Text to display
|
|
109
|
+ * @param justified Justify the text?
|
|
110
|
+ */
|
|
111
|
+ public TextLabel(
|
|
112
|
+ @Nullable final URLBuilder urlBuilder,
|
|
113
|
+ final String text,
|
|
114
|
+ final boolean justified) {
|
87
|
115
|
super(new DefaultStyledDocument());
|
88
|
|
- setEditorKit(new DMDircHTMLEditorKit(URLBuilder.getInstance()));
|
|
116
|
+ setEditorKit(new DMDircHTMLEditorKit(urlBuilder));
|
89
|
117
|
setUI(new BasicTextPaneUI());
|
90
|
118
|
|
91
|
119
|
final StyleSheet styleSheet = ((HTMLDocument) getDocument()).
|