-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLTextView.java
More file actions
46 lines (46 loc) · 1.28 KB
/
Copy pathHTMLTextView.java
File metadata and controls
46 lines (46 loc) · 1.28 KB
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
import java.awt.Component;
import java.awt.Font;
import java.awt.GridLayout;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.html.HTMLEditorKit;
/*
* Created on 01-11-2003 by jesper
* This class should
*/
/**
* @author jesper
*/
public class HTMLTextView extends JPanel {
private JTextPane text;
public Node node;
public HTMLTextView() {
}
public HTMLTextView(StringBuffer code, JPopupMenu contextMenu) {
init(code, contextMenu);
}
public HTMLTextView(StringBuffer code, JPopupMenu contextMenu, Node n) {
node = n;
init(code, contextMenu);
}
private void init(StringBuffer code,JPopupMenu contextMenu) {
setLayout(new GridLayout(1, 1));
text = new JTextPane();
javax.swing.text.html.HTMLEditorKit eKit = new javax.swing.text.html.HTMLEditorKit();
text.setEditorKit(eKit);
text.setContentType("text/html");
JScrollPane scrollText = new JScrollPane(text);
scrollText.setAutoscrolls(true);
//text.setFont(new Font("Verdana", Font.BOLD, 12));
text.setText(code.toString());
text.add(contextMenu);
this.add(scrollText);
}
public String getText() {
return text.getText();
}
public String getUnModyfiedContent() {
return node.content;
}
}