Skip to main content

HTML & JAVA????

5 replies [Last post]
fabryprog
Offline
Joined: 2005-04-13

Hello!
WebBrowser exists in java lib ???

I doing an Help Section for an emulator, but i can't found nothing to use!

Help me....! :-D

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tlund_
Offline
Joined: 2005-04-21

Are you interested in launching the default webbrowser, or displaying html content within java-frames?

JEditorPane has basic support for HTML, but it is not good enough for modern web-pages. (only support for HTML < 4.0)

I suggest you check out JDesktop Integration Components:
https://jdic.dev.java.net/

That project has an desktop-package which let's you launch an url in the systems default webbrowser, or you can embedd the default webbrowser within an java-frame with the Browser-class.

The Desktop class was originally supposed to be included in mustang, but now it seems it won't. Hopefully, both the Desktop and Browser class will be included in J2SE sometime in the near future.

scott_sauyet
Offline
Joined: 2004-08-25

Or check out https://xhtmlrenderer.dev.java.net/ which is building a better HTML renderer component in Java.

fabryprog
Offline
Joined: 2005-04-13

Good.... but links don't do nothing.... ! It isnt very browser... :'-(

steevcoco
Offline
Joined: 2004-05-23

> Good.... but links don't do nothing.... ! It isnt
> very browser... :'-(

Why you....

OK.

Look at the documentation for JEditorPane.

Coco.

steevcoco
Offline
Joined: 2004-05-23

Hello.

Try:

[code]/*
* Radon.java
*
* Created on May 20, 2005.
*
* Copyright 2005 Steven Coco. All rights reserved; worldwide.
*/

import java.awt.HeadlessException;
import java.io.File;
import java.io.IOException;

import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.WindowConstants;

/**
*

Web browser sequal.

*
* @version 1.0
* @author Copyright 2005 Steven Coco. All rights reserved; worldwide.
*/
public class Radon extends JFrame {

/**
*

Constructs your future.

*
* @throws HeadlessException
* @throws IOException
*/
public Radon(final File htmlFile) throws HeadlessException, IOException {
super("Bwahahahahaaa!");
add(new JEditorPane(htmlFile.toURL()));
pack();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setVisible(true);
}

/**
*

Runs your future.

*
* @param args
* args[0] is assumed to be an HTML file.
* @throws Exception
*/
public static void main(final String[] args)
throws HeadlessException, IOException {
new Radon(new File(args[0]));
}

}
[/code]

Good luck,
Steev.