aspose file tools*
The moose likes Applets and the fly likes Text links in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Text links in applet" Watch "Text links in applet" New topic
Author

Text links in applet

mohan kannan
Greenhorn

Joined: Dec 02, 2001
Posts: 26
Hi all
I am displaying content of a file in an applet
My requirement is each line must be a clickable link and must lead to different URL / web page
ie each line has some text and a url delimited by suitable character and the url part is parsed out and the entire line is constructed as a clickable link
This must be achieved for all lines of the applet content
Can it is possible to achieve this in an applet
I am not using JApplet
Thanks
Mohan
Thomas Smets
Ranch Hand

Joined: Dec 11, 2001
Posts: 111
This question has nothing to do with Applet !
Give a look at :
Dr David Marshall web site
If you can't use the JEditorPane give a look at URL following & you have most of it !
Thomas,


Thomas Smets
Just another developper
mohan kannan
Greenhorn

Joined: Dec 02, 2001
Posts: 26
Thanks thomas
Is it possible with applet to open a url by capturing mouse click events
thanks
mohan
David G Risner
Ranch Hand

Joined: May 02, 2002
Posts: 30
Yes, you can.
How are you displaying the text? In a TextArea?
I think you will need to use a specialized object to display the text in order to get the clicking functionality.
One way to do this is to create your own Label-like object that captures mouse clicks. You could then add these objects to a ScrollPane if you need scrolling. Then, of course, you use showDocument to actually display the URL.


David G. Risner<br />Software Engineer<br />California State University, Los Angeles
mohan kannan
Greenhorn

Joined: Dec 02, 2001
Posts: 26
Thanks david
Actually I am using a scrolling text on applet itself using paint method.
Pl indicate how to use showDocument method to open
an URL
Thanks
Mohan
David G Risner
Ranch Hand

Joined: May 02, 2002
Posts: 30
showDocument is really easy to use. From a subclass of Applet, you just do: url is a URL object and target is a string that works the same as the target attribute of the <A HREF> HTML tag.
So if you want to open a file "testing.html" that is is the same directory as the HTML file holding the applet and have it always open in a new window, you would do something like:

Hope that helps you out.
mohan kannan
Greenhorn

Joined: Dec 02, 2001
Posts: 26
Thaks david
I will try out
Regards
Mohan
mohan kannan
Greenhorn

Joined: Dec 02, 2001
Posts: 26
Thanks David
It worked
Regards
Mohab
 
 
subject: Text links in applet