Loading HTML

After loading my Java Program, I want to click a button, like my help menu button, and load an HTML document or a browser with some information thats already there, like a help file.

How would I do this?  How would I point my actionlistener to that html page and load that html page, my Program is not an applet, its a Java program.
gujuraja143Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

objectsCommented:
Your action listener should use Runtime.exec() to launch your browser.

Here's an article describing how to do this:
http://www.javaworld.com/javaworld/javatips/jw-javatip66.html 

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OviCommented:
/*
 * Created on Mar 25, 2003
 *
 * To change this generated comment go to
 * Window>Preferences>Java>Code Generation>Code Template
 */
package tests.swing.text;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;

/**
 * @author ovi
 */
public class URLBrowser {

     public static void main(String[] args) {
          JFrame f = new JFrame();
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          f.setSize(100, 80);
          f.setLocation(50, 100);
          f.getContentPane().setLayout(new BorderLayout());

          JButton help = new JButton("Help");
          help.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    JFrame helpFrame = new JFrame();
                    helpFrame.getContentPane().setLayout(new BorderLayout());
                    JEditorPane browser = new JEditorPane();
                    browser.setEditable(false);
                    try {
                         browser.setPage("http://www.experts-exchange.com");
                    } catch (Exception ex) {
                         ex.printStackTrace();
                    }
                    helpFrame.getContentPane().add(new JScrollPane(browser), BorderLayout.CENTER);
                    helpFrame.setSize(500, 500);
                    helpFrame.setLocation(160, 100);
                    helpFrame.setVisible(true);
               }
          });

          f.getContentPane().add(help, BorderLayout.CENTER);
          f.setVisible(true);
     }
}
0
objectsCommented:
Yes JEditorPane can be used, but it is pretty limited in it's HTML support.
0
OviCommented:
... or if this is not enough you could use JavaHelp.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.