Solved

Gif doesn't showup in JApplet

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to execute a Python program and gather return output in Java 2 63
How to convert from xls to xlsx using java 7 159
Java List 4 76
Java import explained 4 48
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

738 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