944,137 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 23676
  • Java RSS
Dec 8th, 2004
0

How to display a HTML file (in browser window) from Java Program...?

Expand Post »
'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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
apcxpc is offline Offline
55 posts
since Sep 2004
Dec 8th, 2004
0

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.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
apcxpc is offline Offline
55 posts
since Sep 2004
Dec 8th, 2004
0

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
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Nov 3rd, 2011
0

Webbrowser

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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Binesh SAh is offline Offline
1 posts
since Nov 2011
Nov 3rd, 2011
0
Re: How to display a HTML file (in browser window) from Java Program...?
See the Desktop class.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: how to do that in java
Next Thread in Java Forum Timeline: Help with returning array!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC