gvsig-scripting / trunk / org.gvsig.scripting / org.gvsig.scripting.swing / org.gvsig.scripting.swing.impl / src / main / java / org / gvsig / scripting / swing / impl / syntaxhighlight / JEditorPaneSyntaxHighlighting.java @ 165
History | View | Annotate | Download (1.09 KB)
1 | 165 | jobacas | package org.gvsig.scripting.swing.impl.syntaxhighlight; |
---|---|---|---|
2 | |||
3 | import javax.swing.JEditorPane; |
||
4 | import javax.swing.text.Document; |
||
5 | import javax.swing.text.StyledEditorKit; |
||
6 | |||
7 | import org.gvsig.scripting.swing.impl.syntaxhighlight.styles.JavaStyledDocument; |
||
8 | import org.gvsig.scripting.swing.impl.syntaxhighlight.styles.PythonStyledDocument; |
||
9 | |||
10 | public class JEditorPaneSyntaxHighlighting extends JEditorPane { |
||
11 | |||
12 | /**
|
||
13 | *
|
||
14 | */
|
||
15 | private static final long serialVersionUID = -4451156833693922180L; |
||
16 | |||
17 | public JEditorPaneSyntaxHighlighting() {
|
||
18 | |||
19 | this.setEditorKitForContentType(
|
||
20 | "text/java",
|
||
21 | new StyledEditorKit() |
||
22 | { |
||
23 | public Document createDefaultDocument() |
||
24 | { |
||
25 | return new JavaStyledDocument(); |
||
26 | } |
||
27 | } |
||
28 | ); |
||
29 | this.setEditorKitForContentType(
|
||
30 | "text/javascript",
|
||
31 | new StyledEditorKit() |
||
32 | { |
||
33 | public Document createDefaultDocument() |
||
34 | { |
||
35 | return new JavaStyledDocument(); |
||
36 | } |
||
37 | } |
||
38 | ); |
||
39 | this.setEditorKitForContentType(
|
||
40 | "text/python",
|
||
41 | new StyledEditorKit() |
||
42 | { |
||
43 | public Document createDefaultDocument() |
||
44 | { |
||
45 | return new PythonStyledDocument(); |
||
46 | } |
||
47 | } |
||
48 | ); |
||
49 | } |
||
50 | |||
51 | } |