Solved

Gif doesn't showup in JApplet

Posted on 1998-07-21
5
185 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 100 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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

623 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