-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRSEditorPane.java
More file actions
47 lines (39 loc) · 773 Bytes
/
Copy pathRSEditorPane.java
File metadata and controls
47 lines (39 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
Override and add a few methods for ease of use
*/
import javax.swing.*;
public class RSEditorPane extends JTextPane
{
private String body = "";
private String htmlStart = "<html>";
private String htmlEnd = "</html>";
private String pStart = "<p>";
private String pEnd = "</p>";
public RSEditorPane()
{
super();
}
public String getBody()
{
return body;
}
public void setBody(String bodyIn)
{
body = bodyIn;
updatePane();
}
public synchronized void append(String sIn)
{
if(body.length() < 3000)
{
body = pStart + sIn + pEnd + body;
updatePane();
}else{
body = pStart + sIn + pEnd;
}
}
public void updatePane()
{
setText(htmlStart + pStart + body + pEnd + htmlEnd);
}
}