DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   How to display a HTML file (in browser window) from Java Program...? (http://www.daniweb.com/forums/thread15237.html)

apcxpc Dec 7th, 2004 11:33 pm
How to display a HTML file (in browser window) from Java Program...?
 
'ellos

So I'm making a Hangman game, and for the sake of completeness I want to have a HELP feature. When the Help button is clicked, a browser window should open up (not *within* the game frame... but just generally) and display the HTML Help file. How do I do this?

So I have a full GUI, with a HELP button (a JButton) with an added Action Listener defined as follows:
(this is actually an inner class within another GUI class)

HelpListener implements ActionListener{
public void actionPerformed(ActionEvent evt){
//...insert code here, that will open up a browser window displaying a HTML help file (containing Hangman Help information)
}
}


Any help would be much appreciated. :idea:

apcxpc Dec 8th, 2004 4:12 am
Re: How to display a HTML file (in browser window) from Java Program...?
 
Actually, to display either a HTML or text file in a browser window ...OR... just a text file in like Notepad or something.

nanosani Dec 8th, 2004 4:50 pm
Re: How to display a HTML file (in browser window) from Java Program...?
 
You should be using a dialog box or a new frame ( as you like ) with a JEditorPane in it .... JEditorPane can display html/rich text format contents ... you can use the methods ... read or setText or setPage of JEditorPane to show the respective content.

For further information .. consult java api for javax.swing.JEditorPane


All times are GMT -4. The time now is 6:48 am.

Forum system based on vBulletin Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
©2003 - 2010 DaniWeb® LLC