Java - 在Jframe中显示网页 [英] Java - Showing a Webpage In Jframe

查看:537
本文介绍了Java - 在Jframe中显示网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在游戏中添加了更新日志。我正在使用tumblr来显示更新消息。我使用简单代码(下面列出)来显示它,但是当我运行它时它看起来就像原来的tumblr!

I have just recently added a update log to my game. I am using tumblr to show the update news. I used simple code (Listed Below) to show it but when I run it it looks nothing like the original tumblr!

package javaapplication32;

import javax.swing.*;

public class GetWebPage {
    public static void main(String args[]) throws Exception {
      JEditorPane website = new JEditorPane("http://smo-gram.tumblr.com/");
      website.setEditable(false);

      JFrame frame = new JFrame("Google");
      frame.add(new JScrollPane(website));
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      frame.pack();
    }

}


推荐答案

还有其他一些选择。如果您需要HTML5支持,请切换到JavaFX(这比Swing IMO更好)。还有一个HTML4 / CSS2渲染器可用于Swing 名为Cobra ,看起来还不错。另一种选择是 Frostwire JWebBrowser ,如果你不介意包含本机代码,它似乎给出了你在Swing中完整的HTML5和CSS3。

There's a few other options available. If you need HTML5 support, switch over to JavaFX (It's way better than Swing IMO). There's also a HTML4/CSS2 renderer available for Swing called Cobra, and it seems pretty good. Another option would be Frostwire JWebBrowser, if you don't mind including native code, it seems to give you full HTML5 and CSS3 in Swing.

这篇关于Java - 在Jframe中显示网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆