[英]Display a webpage inside a swing application
我想在java swing應用程序中顯示一個網頁。 類似於使用HTML時,但在Java Swing中。 這是可能的,如果是的話,怎么樣?
使用JEditorPane
:
JEditorPane jep = new JEditorPane();
jep.setEditable(false);
try {
jep.setPage("http://www.yoursite.com");
}catch (IOException e) {
jep.setContentType("text/html");
jep.setText("<html>Could not load</html>");
}
JScrollPane scrollPane = new JScrollPane(jep);
JFrame f = new JFrame("Test HTML");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(scrollPane);
f.setPreferredSize(new Dimension(800,600));
f.setVisible(true);
您可能需要查看http://java.dzone.com/articles/web-browser-your-java-swing 。
JxBrowser允許您通過將瀏覽器嵌入到swing應用程序中來顯示任何網頁。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.