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

RFE: Toolkit.getImage to support Image IO formats, eg WBMP & BMP

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P5 P5
    • None
    • 5.0
    • client-libs
    • 2d
    • x86
    • windows_2000



      Name: pr15447 Date: 02/13/2004


      FULL PRODUCT VERSION :
      Tiger 1.5 beta

      ADDITIONAL OS VERSION INFORMATION :
      WIndows 2000 with service pack two

      A DESCRIPTION OF THE PROBLEM :
      class java.awt.Image and javax.swing.ImageIcon will not display BMP or WBMP image format. Both classes return -1 for image height and width. I have checked to see if the images are corrupted by use of other image editing programs and they always run fine. The same technique used to display gif's, jpeg's and png's is used but the BMP and WBMP will simply not appear on a button or label.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      //Make the ImageIcon by creating an image with the toolkit method

      ImageIcon imageIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(...."picture.bmp"));

      //Make a label with the icon
      JLabel lbl = new JLabel(imageIcon);
      //This won't work either
      lbl.setIcon(imageIcon);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected Result is a Jlabel with an image.
      ACTUAL -
      Actual result was a JLabel with anot much

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error or exceptions thrown just image heigth and width = -1;

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class NoBitmap
      {
        public static void main(String[] a)
        {
          ImageIcon image = new ImageIcon(getClass().getResource( "picture.bmp")));
          JLabel lbl = new JLabel(image);
          JOptionPane.showMessageDialog(null, lbl);
          System.exit(0);
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Um I dont' know any. It just doesn't work
      (Incident Review ID: 238654)
      ======================================================================

            Unassigned Unassigned
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: