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

Recommended Answers

All 4 Replies

Actually, to display either a HTML or text file in a browser window ...OR... just a text file in like Notepad or something.

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

I have built web browser in java.It compile and gives following error

note:browser.java uses or overwrides a deprecacted api.
note:recompile with -xint:dprecation for details.

but execute it proprly . when I open Google It opens page with html tag.
So,please Someone can help me how to display html files or websites properly.
If It's java code is available please post here or send in my Email address: sahbinesh@yahoo.com

See the Desktop class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.