United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6933784 NIMBUS: ImageView getNoImageIcon and getLoadingImageIcon returns nulls instead of an icon
JDK-6933784 : NIMBUS: ImageView getNoImageIcon and getLoadingImageIcon returns nulls instead of an icon

Details
Type:
Bug
Submit Date:
2010-03-10
Status:
Resolved
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2010-04-14
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u10
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
Consider this small program:
import java.awt.*;
import java.io.*;
import java.io.PrintWriter;
import java.net.*;
import java.util.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;

public class test
{
         public static void main (String args[])
         {
                String test="<HTML><TITLE>Test</TITLE><BODY><IMG id=test></BODY></HTML>";
                HTMLEditorKit c = new HTMLEditorKit();
                HTMLDocument doc = new HTMLDocument();

                  try {
                             c.read(new StringReader(test), doc, 0);
                      } catch (IOException e) {
                             System.out.println("Failed Unexpected IOException " + e);
                      } catch (BadLocationException e) {
                             System.out.println("Failed Unexpected BadLocationException " + e);
                      } catch (RuntimeException e) {
                             System.out.println("Failed Unexpected RuntimeException " + e);
                      }
                  Element elem = doc.getElement("test");
                  ImageView iv = new ImageView(elem);

                  if (!(iv.getLoadingImageIcon()!=null)){
                      System.out.println(" Failed Method getLoadingImageIcon.");
                  }else {
                      System.out.println(" Passed Method getLoadingImageIcon.");}
                  if (!(iv.getNoImageIcon()!=null)){
                      System.out.println(" Failed Method getNoImageIcon.");
                      }else {
                  System.out.println(" Passed Method getNoImageIcon."); }

        }
}


When run with nimbus l&f it gives wrong results:

/export/jdk/jdk1.6.0_18/bin/java -cp . -Dswing.defaultlaf=com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel test
Failed Method getLoadingImageIcon.
Failed Method getNoImageIcon.

/export/jdk/jdk1.6.0_10/bin/java -cp . test
Passed Method getLoadingImageIcon.
Passed Method getNoImageIcon.


According to http://java.sun.com/javase/6/docs/api/javax/swing/text/html/ImageView.html
getNoImageIcon()
          Returns the icon to use if the image couldn't be found.
getLoadingImageIcon()
          Returns the icon to use while in the process of loading the image.

                                    

Comments
EVALUATION

We should add "html.pendingImage" and "html.missingImage" images into UIDefaults map for Synth LaF. They are missed because Synth LaF doesn't use UIDefaults from the BasicLookAndFeel class
                                     
2010-03-15



Hardware and Software, Engineered to Work Together