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

x
?
Solved

Gif doesn't showup in JApplet

Posted on 1998-07-21
5
Medium Priority
?
186 Views
Last Modified: 2010-04-16
I have a JApplet which will bring up another JFrame with some gif pictures.  Since the JApplet contains the "public static void main", it calls up the JFrame and the gif load up without any problem.  However, once we put it up onto a web server.  It returns some kind messages like "the gif is not permitted to load up".  I have set the codebase=./ .  However it still doesn't work.  Can anybody tell me how to solve this ?
0
Comment
Question by:andrewma
[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
5 Comments
 
LVL 5

Expert Comment

by:msmolyak
ID: 1227303
How are you loading the image? In the application you are probably getting it from a local file using that file name. In case of an applet you have to use Toolkit.getImage(URL myUrl) method. To construct a URL use Applet.getDocumentBase() method which returns the URL of the HTML file containing the APPLET tag. You should be able to build a URL of the image based on that.
0
 

Author Comment

by:andrewma
ID: 1227304
Thanks for your reponse.  I need a futher clarification on the ToolKit part.  Since ToolKit is abstract, how can you instantiate it to invoke the getImage method ?
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1227305
Toolkit.getDefaultToolkit() returns the default toolkit for the current platform.
0
 

Author Comment

by:andrewma
ID: 1227306
So where do you store it ?  You cannot define a Toolkit tool = Toolkit.getDefaultToolkit () to store it, because it is abstract.
0
 
LVL 5

Accepted Solution

by:
msmolyak earned 300 total points
ID: 1227307
That's exactly what you do. Even though Toolkit type is abstract it does not mean that you cannot assign the values of subclass of a Toolkit class to a variable of Toolkit type.

Toolkit.getDefaultToolkit() returns a concrete subclass of Toolkit class.

It would be more productive if you ask additional questions without rejecting the answer. Reject the answer only if you think it is incorrect or incomplete and the additional info is not furnished.
0

Featured Post

Independent Software Vendors: 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!

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 theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

704 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