这是我要显示的 html: http://boba.dyndns-server.com/Degrees/Art_History_Track_BA.html
我也想显示这个 google calendar以及。 (但是这个链接不是优先级)
我查看了 DJProject它似乎需要 win32 计算机,但我希望该程序能够在 mac 和 windows 上运行。如果我对 DJProject 的理解有误,你能解释一下如何实现他们的 Simple Example 吗?在 Mac 上使用 Eclipse。
我的目标是将链接嵌入到 JScrollPanel 中,开销尽可能小。 感谢您提出的所有建议。
**JEditor Pane 可以显示html,但不能显示htmls 中带有css 的html。
***如果你知道移除 css,我也想考虑一下
** 我要显示的 html 是由 pdf 转换器生成的。
最佳答案
您可以直接使用 SWT 浏览器:
import org.eclipse.swt.*;
import org.eclipse.swt.browser.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Main {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Browser browser = new Browser(shell, SWT.NONE);
browser.setUrl("http://printf.ru/");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
定制:http://www.eclipse.org/swt/snippets/
完整教程:http://www.eclipse.org/articles/Article-SWT-browser-widget/browser.html
关于java - 在 Java GUI 中显示 HTML/CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5341303/