下面的示例展示了如何在基于swing的应用程序中显示HTML文件的HTML内容。
使用以下API -
JEditorPane - 创建一个显示HTML内容的编辑框。
jEditorPane.setPage(URL url) - 从传递和显示的URL获取HTML。
示例
在存在SwingTester.java 的当前目录中创建一个html文件:test.html。
Swing TesterSwing API is a set of extensible GUI Components
to ease the developer's life to create JAVA based Front End/GUI
Applications. It is build on top of AWT API and acts as a replacement of
AWT API, since it has almost every control corresponding to AWT controls.
Swing component follows a Model-View-Controller architecture to
fulfill the following criterias.
A single API is to be sufficient to support multiple look and feel.
API is to be model driven so that the highest level API is not required to have data.
API is to use the Java Bean model so that Builder Tools and IDE can provide better services to the deve