Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

HTML rendering in Swing components

Thread view: 
Yar - 03 Aug 2006 13:10 GMT
Hello,

If I have a JLabel or a JTextEditor component with the following
caption
<html><img src=http://192.168.1.1/image.jpg></html>

is there any way I control the http connection that will do the loading
of the image from the webserver?
I would like to add a cookie for session tracking purposes to the
automatically created connection.

Is there like global static parameters, to do that?

Thank you
Yar
Andrew Thompson - 03 Aug 2006 16:57 GMT
...
> If I have a JLabel or a JTextEditor component with the following
> caption
> <html><img src=http://192.168.1.1/image.jpg></html>

the src needs to be inside quotes to be valid HTML,

<html><img src='http://192.168.1.1/image.jpg'></html>

..and from memory, it needs a <body> element..

<html><body><img src='http://192.168.1.1/image.jpg'></body></html>

> is there any way I control the http connection that will do the loading
> of the image from the webserver?
> I would like to add a cookie for session tracking purposes to the
> automatically created connection.

You can send parameters to the server inside the URL.

 src='http://192.168.1.1/image.jpg?compression=9&size=800'

( I am not sure if that answers your question,
I am not entirely clear what you mean. )

Andrew T.
Yar - 03 Aug 2006 22:14 GMT
Thanks Andrew,

What i was looking for was to override the standard behavior for
downloading the images from HTML based Swing Text components.

I found my answer: the ImageView class does the work. By overriding it
I can do what i want, and authenticating to the webserver if necessary,
inserting session tracking cookies if necessary.
Need also to override the HTMLEditorKit for it to return the correct
ImageView class

Aron
> ...
> > If I have a JLabel or a JTextEditor component with the following
[quoted text clipped - 22 lines]
>
> Andrew T.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.