在 JFrame 或打开浏览器中显示 HTML 标记
我正在编写一个创建 HTML 代码的 Java 程序。
预览代码的最佳/最简单的可能性是什么?
- 在
JFrame
中显示代码:我怎样才能做到这一点? - 使用创建的文件打开Windows浏览器?这可能吗?
- 一种完全不同的方法?
I am writing a Java program that creates HTML code.
What's the best/easiest possibility to have a preview of the code?
- Show the code in the
JFrame
: How can I do this? - Open the windows browser with the created File? Is this possible?
- A totally different approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两者都很容易做到。 这里是 Java 教程中的一个页面,展示了如何显示Swing 中的 HTML(您可以使用
file:
URL 来显示文件的内容。)您可以使用 Java 6 的Desktop
类在外部浏览器中显示 URL:交替,将数据保存在扩展名为
*.html
的文件中并使用Both are quite easy to do. Here is a page from the Java tutorial that shows how to display HTML in Swing (you'd use a
file:
URL to display the contents of a file.) You can display a URL in an external browser using Java 6'sDesktop
class:Alternately, save the data in a file with the
*.html
extension and use