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

JLabel Images Having Black Fills Or Incomplete

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 6u17
    • client-libs

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_17"
      Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
      Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP version 2002 SP3

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      not that it matters, but development is done over a wireless network.

      A DESCRIPTION OF THE PROBLEM :
       byte [] imagebytes = new byte [ getClass().getResourceAsStream("logo-trim.gif").available()];
                getClass().getResourceAsStream("logo-trim.gif").read(imagebytes);
                ImageIcon tl = new ImageIcon(imagebytes);
                //ImageIcon tl = new ImageIcon("prod_logo.jpg");
                JLabel translogo = new JLabel (tl);

                translogo.setOpaque(true);
                translogo.setToolTipText("Visit www.transolveltd.com To Get The Lastest Transolve Tech News");

      ----
      image pixel size: 261wx138h, 96dpi, bitdepth:8, framecount:1

      ---

      image is included as a resource. image loads fine in the jbulider development enviroment. however when packaged into a jar file. the image doesnt fully show, the rest is filled with black. i have tried this with multiply images thinking there was an error in the inital image, but i get simpler results, partly shown with black fill. i have used two different computers and i got thesame results. i cant figure out why this is happening, when i reduce the size of the image it shows ok.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      get any image about thesame size or bigger and use the line of code to load it in packaged jar file.

       byte [] imagebytes = new byte [ getClass().getResourceAsStream("logo-trim.gif").available()];
                getClass().getResourceAsStream("logo-trim.gif").read(imagebytes);
                ImageIcon tl = new ImageIcon(imagebytes);
                //ImageIcon tl = new ImageIcon("prod_logo.jpg");
                JLabel translogo = new JLabel (tl);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      i was expecting the image will load fine without any black fills or incompletion. as this was the case in Jbuilder development enviroment. however packaging into a jar file for deployment i recieved the error
      ACTUAL -
      incomplete image with black fill.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      no error messages.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
       byte [] imagebytes = new byte [ getClass().getResourceAsStream("logo-trim.gif").available()];
                getClass().getResourceAsStream("logo-trim.gif").read(imagebytes);
                ImageIcon tl = new ImageIcon(imagebytes);
                //ImageIcon tl = new ImageIcon("prod_logo.jpg");
                JLabel translogo = new JLabel (tl);

                translogo.setOpaque(true);
                translogo.setToolTipText("Visit www.transolveltd.com To Get The Lastest Transolve Tech News");
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      none apart from reducing the size of the image.

      Attachments

        Activity

          People

            alexp Alexander Potochkin (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: