tags:

views:

126

answers:

5

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"&gt;

and it will display google in the frame.

i don't want it to open a browser, just to open up within the form.

thanks

+2  A: 

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 :)

Michel Kogan
A: 

If you are using Swing then try using a JEditorPane

objects
A: 

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

JCasso
i just want to be able to display a webpage.
Tuffy G
OK what will be the input? Is that page will be something like Google, or a web page that is designed by you? Will it be a simple/single html or a complete web site? If it is just one page and you will provide the input than you can go for JEditorPane. Otherwise you may search jeditorpane in google and see lots of programmers complaining from it. AFAIK there is no better alternative.
JCasso
the input will be press f1 for help and the page appears.it will be on my site but i used google just for an example
Tuffy G
Ah OK, in this case go for JEditorPane. @Antol already provided a snippet
JCasso
thank you for your help
Tuffy G
+1  A: 

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();
    }

}
Anton
perfect.thanks for that.
Tuffy G
A: 

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.

Horcrux7