This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to use html for LABEL Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "How to use html for LABEL " Watch "How to use html for LABEL " New topic
Author

How to use html for LABEL

Em Aiy
Ranch Hand

Joined: May 11, 2006
Posts: 225
hi,

I am using Swing for some gui. I have to open some html page for which i am using JLabel with the following html tag


I was thinking that it'd open html file in browser when i click on label (without implementing any action listener). But it is not. Can somebody tell me what the wrong i am doing?


The difference between <b>failure</b> and <b>success</b> is often being <b>right</b> and being <b>exactly right</b>.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8264

HTML support in most Swing components is provided simply to make text formatting easy. It will not duplicate the functionality of a web browser (i.e. clicking on an anchor tag taking you to another page). See here for the Java Tutorial chapter on HTML in Swing.
You either need to implement a listener to handle the mouse click or use a component like EditorPane which can more fully parse and render HTML.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use html for LABEL
 
Similar Threads
HTML Link in a JLabel?
to show the Report
How to create a multiple line JLabel.
how to detect the change?
JLabel Word Wrap