Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problems loading images from a website.

Posted on 2004-09-12
6
Medium Priority
?
232 Views
Last Modified: 2012-05-05
Hi there, I am trying to display some images in a Japplet from a website.  I load them fine the first time, but if I refresh the JApplet, then some of the images don't reload, and when I display them I get a broken link.  Has anyone heard of this before?  Does anyone know if you can display an image from a .jar file in html?  If I could do that I am sure that would solve all my problems.  I am using:

           images_ac.append("<img src=\"" +mEmoticonData_t[i].mFileName_ac.toString()+">");

to load the images and putting it into a JEditPane which is in HTML mode.  Any suggestions?  Thanks.
0
Comment
Question by:kesea
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:kesea
ID: 12040214
Oops, the one thing I forgot to add is the mFileName_ac is a URL, it is http://www.website.com/picture/image.gif

If I could just include these picturs in my Jar and display them in HTML that would be great, i.e. putting picture/image.gif

Thanks.

kes.
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 12040244
to access them from the jar use class.getResource() to get their URL.
0
 
LVL 16

Expert Comment

by:gnoon
ID: 12040666
>when I display them I get a broken link.
>....
>images_ac.append("<img src=\"" +mEmoticonData_t[i].mFileName_ac.toString()+">");

It means that mEmoticonData_t[i].mFileName_ac.toString() returns empty string or a wrong image path. You should check it first.

>I load them fine the first time, but if I refresh the JApplet, then some of the images don't reload
I've found this problem before, but my case is that when refresh the page, the applet got an error before display the image, so it wasn't reached.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kesea
ID: 12047142
          URL image = getClass().getResource(mEmoticonData_t[i].mImageName_ac.
                                              toString());
           images_ac.append("<img src=\"" +
//                            mEmoticonData_t[i].mURLName_ac.toString()+
                            image.getRef()+
                            "\" Width=\"1\" Height=\"1\">");

OK I tried loading it like this, but when I load it I get a null error?  I need to load it like this for putting images onto a list, but how can I put them into HTML?  I need to know how to get the proper reference to the image in the .jar file.  Thanks.
0
 

Author Comment

by:kesea
ID: 12047175
Oops that should have said, I have used this for loading the images into a list, but I need to get a refernce to the picture to put it in HTML, because I have that in a JEditorPane.  Thanks.
0
 
LVL 92

Expert Comment

by:objects
ID: 12048715
no worries :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question