Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4251549

sun.awt.image.FileImageSource implementation need to be clarified

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.2_02, 1.2.2
    • client-libs
    • 2d
    • generic
    • generic

      Bug 4074456 was reported as fixed, but it's not clear that
      the evaluation was appropriate. Furthermore, I am still
      able to reproduce the problem.

      Following the guideline of the Java Tutorial:
      http://java.sun.com/docs/books/tutorial/jar/basics/run.html

      It seems that the API allows a mechanism for applets to access
      images and sounds from a jar file. This mechanism doesn't
      seem to appear to work for applications. Specifically,
      put class files and gif files into a jar, test.jar
      The following application will not find the specified gif file
      from the jar. Run using: java -jar test.jar

      import javax.swing.*;
      import java.awt.*;

      class GifTest extends JFrame
      {
          public static void main(String s[])
          {
               GifTest gt = new GifTest();
               gt.show();
          }

          //constructor
          public GifTest()
          {

              Dimension sDim = Toolkit.getDefaultToolkit().getScreenSize();
              int frameW = sDim.width/2;
              int frameH = sDim.height/2;
              setBounds((sDim.width-frameW)/2,(sDim.height-frameH)/2,frameW,frameH);
              JButton saveButton = new JButton("save");
              saveButton.setIcon(new ImageIcon("images/" + "save.gif"));
              getContentPane().add(saveButton);
          }
      }

      The workaround shows what is necessary to get this to work.
      If this is the intended behavior (you can't bundle your application
      and images in a jar), then the documentation should be changed to
      reflect this. For starters, the java tutorial.

      See attached workspace.

      mark.chamness@Eng 1999-07-02

            tdv Dmitri Trembovetski (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: