如何让网页在框架中打开?

发布于 2024-08-16 17:32:19 字数 210 浏览 4 评论 0 原文

如何让网页在框架中打开?

(我正在使用netbeans和java)

例如,您可以在html页面中使用它

  <frame src="http://www.google.com">

,它将在框架中显示google。

我不想让它打开浏览器,只是在框架内打开。我怎样才能做到这一点?

How do I get a webpage to open up in a frame?

(I'm using netbeans and java)

e.g in a html page you can use

  <frame src="http://www.google.com">

and it will display google in the frame.

I don't want it to open a browser, just to open up within the frame. How can I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

玩心态 2024-08-23 17:32:19

下面是如何使用 JEditorPane 加载 google 的快速示例。我希望这就是您正在寻找的,但我仍然不能 100% 确定您到底想要什么。如果您能提供更多有关您正在做的事情的信息,我将能够为您提供更多帮助。

import javax.swing.*;

public class GetWebPage {
    public static void main(String args[]) throws Exception {
        JEditorPane website = new JEditorPane("http://www.google.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();
    }

}

Here is a quick example of how to load google with the JEditorPane. I hope this is what you are looking for, but I'm still not 100% sure what exactly you want. If you could provide a bit more information about what you are doing I would be able to help you more.

import javax.swing.*;

public class GetWebPage {
    public static void main(String args[]) throws Exception {
        JEditorPane website = new JEditorPane("http://www.google.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();
    }

}
樱花细雨 2024-08-23 17:32:19

希望有所帮助

,但如果您只想在html中使用类似FRAME的内容,会对您有所帮助。

还有一个“Mozilla Widget for Java Swing”调用 MozSwing,但也许这不是你想要的:)

Hope this helps

but if you just want something like FRAME in html, this will help you.

There is also a "Mozilla Widget for Java Swing" call MozSwing, but maybe it's not what you want :)

戏舞 2024-08-23 17:32:19

因此,您需要 J2SE 中的等效 Web 浏览器 (.net) 控件。据我所知,J2SE 中没有类似的东西。

只有 JEditorPane 这是非常非常弱的。

编辑:有一些商业组件:

其中之一是 ICEbrowser

So you are asking for a webbrowser (.net) control equivalent in J2SE. As far as I know there is no equivalent for it in J2SE.

There only is JEditorPane which is very very weak.

Edit: There are some commercial components:

One of them is ICEbrowser

霓裳挽歌倾城醉 2024-08-23 17:32:19

默认的 JEditorPane 很差。它只能呈现 HTML 3.2。使用 JWebEngine,您可以显示 HTML 4。JWebEngine 是纯 Java 且独立于平台。 ICE 浏览器已停产。

The default JEditorPane is very poor. It can only render HTML 3.2. With JWebEngine you can display HTML 4. JWebEngine is pure Java and platform independent. The ICEbrowser is EOL.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文