Created
March 11, 2015 21:34
-
-
Save bmcculley/6b940962c68aed9bb791 to your computer and use it in GitHub Desktop.
jsyntaxpane example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.BorderLayout; | |
import java.awt.Container; | |
import javax.swing.JEditorPane; | |
import javax.swing.JFrame; | |
import javax.swing.JScrollPane; | |
import javax.swing.WindowConstants; | |
import jsyntaxpane.DefaultSyntaxKit; | |
public class SyntaxTester { | |
public static void main(String[] args) { | |
java.awt.EventQueue.invokeLater(new Runnable() { | |
@Override | |
public void run() { | |
SyntaxTester st = new SyntaxTester(); | |
} | |
}); | |
} | |
public SyntaxTester() { | |
JFrame f = new JFrame(SyntaxTester.class.getName()); | |
final Container c = f.getContentPane(); | |
c.setLayout(new BorderLayout()); | |
DefaultSyntaxKit.initKit(); | |
final JEditorPane codeEditor = new JEditorPane(); | |
JScrollPane scrPane = new JScrollPane(codeEditor); | |
c.add(scrPane, BorderLayout.CENTER); | |
c.doLayout(); | |
codeEditor.setContentType("text/java"); | |
codeEditor.setText("public static void main(String[] args) {\n}"); | |
f.setSize(800, 600); | |
f.setVisible(true); | |
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | |
} | |
} |
Error: Could not find or load main class SyntaxTester
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compile:
javac -cp jsyntaxpane-0.9.5-b29.jar:. SyntaxTester.java
Execute:
java -cp jsyntaxpane-0.9.5-b29.jar:. SyntaxTester