Java Reference
In-Depth Information
import
HtmlDOM.Element;
import
FrontEnd.SampleDocumenter;
import
javax.swing.*;
import
javax.swing.text.*;
import
java.awt.*; //for layout managers
import
java.awt.event.*; //for action and window events
import
javax.swing.event.*;
import
javax.swing.text.html.*; // for HyperlinkListener
import
java.net.URL;
import
java.io.*;
class
TestFrame
extends
JFrame
implements
ActionListener, HyperlinkListener {
private final static
String htmlMessage
#
"<html><head>"
!
"<body bgcolor
#
navy text
#
yellow>"
!
"<h1>Java Analyzer with HTML Output</h1>"
!
"<font face
#
\"Arial,Helvetica\">"
!
"<p>This program analyzes java source code and
!
" produces output in HTML format.</p>"
!
"<p>To test the basic functionalities insert java "
!
"code in the text area on the left side of the "
!
"window, then press the <b>Analyze</b> button.</p>"
!
"<p><i>Enjoy</i>, "
!
"<a href
#
\"http://thalia.unibg.it/~brugali/\"> "
!
"Davide</a></font> and "
!
"<a href
#
\"http://www.idi.ntnu.no/~marco/\">"
!
"Marco</a></font>"
!
"</body>"
!
"</html>" ;
private final static
String javaCode
#
"// this is a test class...\n"
!
"class TestClass {\n"
!
" String an_attribute;\n"
!
" public int a_public_attribute;\n"
!
" public void a_method(int a_parameter){\n"
!
" String s;\n"
!
" s
#
\"string content\";\n"
!
" }\n"
!
" abstract private int another_method();\n"
!
"}\n" ;
// the HTML panel visual component
private
JEditorPane htmlPane;
// the text is a visual component