HTML rendering in Swing components

Y

Yar

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
 
A

Andrew Thompson

Yar wrote:
....
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..

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.
 
Y

Yar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top