HTML llink JEditor pane  
Author Message
CSUIDL PROGRAMMEr





PostPosted: 4/27/2006 2:16:00 AM Top

java-programmer, HTML llink JEditor pane Folks
I am creating an application where i am getting a file name by
performing a search.
This file name is displayed in JEditor pane.
I want to make this file as a html link ,so when user clicks the link,
it opens the file

Any help
thanks

 
Paul Hamaker





PostPosted: 4/27/2006 4:50:00 AM Top

java-programmer >> HTML llink JEditor pane http://javalessons.com/cgi-bin/fun/java-tutorials-main.cgi?ses=ao789&code=edp&sub=gui
shows how to open it in the editor pane.
--------------------
Paul Hamaker, SEMM, teaching ICT since 1987
http://javalessons.com

 
CSUIDL PROGRAMMEr





PostPosted: 4/28/2006 12:20:00 AM Top

java-programmer >> HTML llink JEditor pane but the originally file is not a html file. It is a text file
Example if i do a search for UK in my application

here is what shows in JEditorPanel

/root/Desktop/project/uk.txt

I want this to show up as html link. so that when users click it ,it
opens the file in a new window.

thanks

 
 
CSUIDL PROGRAMMEr





PostPosted: 4/28/2006 12:20:00 AM Top

java-programmer >> HTML llink JEditor pane but the originally file is not a html file. It is a text file
Example if i do a search for UK in my application

here is what shows in JEditorPanel

/root/Desktop/project/uk.txt

I want this to show up as html link. so that when users click it ,it
opens the file in a new window.

thanks

 
 
Jochen Wilhelm





PostPosted: 4/28/2006 3:07:00 AM Top

java-programmer >> HTML llink JEditor pane CSUIDL PROGRAMMEr wrote:

> but the originally file is not a html file. It is a text file
> Example if i do a search for UK in my application
>
> here is what shows in JEditorPanel
>
> /root/Desktop/project/uk.txt
>
> I want this to show up as html link. so that when users click it ,it
> opens the file in a new window.
>
> thanks
Hi,
i do not quite understand why you want to use the JEditorPane for this? Do
you search return the results already in HTML format? If not, a JList or a
custom component would perhaps more suitable.

If your search returns HTML you have to add a HyperLinkListener to your
JEditorPAne.
Tutorial
http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html

i hope this helps a little bit.


--
Regards

Jochen
 
 
CSUIDL PROGRAMMEr





PostPosted: 4/28/2006 3:55:00 AM Top

java-programmer >> HTML llink JEditor pane thanks
Ok let me explain

I am creating a GUI/Swing application that will perform a search
The user types in keyword in Text field .

Now the results are suppose to be shown in a swing component.(
JtextArea i think is more suitable for this)
The results are not in HTML Format.
They are simple text files.

All i want to do is make these test files as hyperlink. So that when a
user clicks the link . it opens a new window.
It is kind of google search only that there is no html format here.
thanks

 
 
Stephen Marjoribanks





PostPosted: 4/29/2006 4:56:00 PM Top

java-programmer >> HTML llink JEditor pane CSUIDL PROGRAMMEr wrote:
> thanks
> Ok let me explain
>
> I am creating a GUI/Swing application that will perform a search
> The user types in keyword in Text field .
>
> Now the results are suppose to be shown in a swing component.(
> JtextArea i think is more suitable for this)
> The results are not in HTML Format.
> They are simple text files.
>
> All i want to do is make these test files as hyperlink. So that when a
> user clicks the link . it opens a new window.
> It is kind of google search only that there is no html format here.
> thanks
>

As far as I'm aware in order to have functioning hyperlinks, you have to
set them up using the standard html code and then use a
HyperlinkListener. Just add some code which marks up the returned string
into html.

You could mimick a hyperlink event by subclassing another component and
making it look similar to a hyperlink and using standard component event
listeners if you wanted as well.

Steve
 
 
CSUIDL PROGRAMMEr





PostPosted: 5/12/2006 1:33:00 AM Top

java-programmer >> HTML llink JEditor pane That is problem
I am setting up code
But html link do not appear in JtextArea
They appear as string

thanks