Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6711072
Votes 0
Synopsis Nimbus L&F: getBaseline() broken with Nimbus
Category java:classes_swing
Reported Against
Release Fixed 6u10(b26)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs
Submit Date 05-JUN-2008
Description
Originally filed as a JavaFX Script bug, this is actually a bug in Nimbus.

Try the following to get a NPE in BasicListUI:

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

public class BLTest {

    private static void createAndShowGUI(String[] args) {
        try {

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (Exception e) {}

        JList list = new JList();
        list.getBaseline(1, 1);
    }

    public static void main(final String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI(args);
            }
        });
    }
} 


Original description follows:

Logging this for doc (added to cc list).
-------------------
When I run the JavaFXScriptImgSearch2 project (it's the JavaFX Script Image Search program that you did for me). I've attached a zip file that contains the source and the project code. If I try to run the project with JDK 1.6.0_10, it generates a Null Pointer exception as follows:

C:\Program Files\Java\jdk1.6.0_10\bin>java.exe -jar C:\MyNetBeansProjects\JavaFScriptImgSearch2\dist\JavaFXScriptImgSearch2.jar

java.lang.NullPointerException
       at javax.swing.plaf.basic.BasicListUI.getBaseline(BasicListUI.java:470)
       at javax.swing.JComponent.getBaseline(JComponent.java:2530)
       at javax.swing.plaf.basic.BasicScrollPaneUI.getBaseline(BasicScrollPaneI.java:386)
      ...
       at javafx.gui.Window.setWindowVisibility$impl(Window.fx:130)
       at javafx.gui.Frame.setWindowVisibility(Frame.fx:22)
       at javafx.gui.Window.postInit$(Window.fx:170)
       at javafx.gui.Frame.postInit$(Frame.fx:22)
       at javafx.gui.Frame.initialize$(Frame.fx:22)
       at javafxscriptimgsearch2.Main.javafx$run$(Main.fx:89)

However, if I run it in JDK 1.6.0_05, it runs fine.
Posted Date : 2008-06-05 18:15:02.0
Work Around
N/A
Evaluation
Nimbus is not providing the "List.cellRenderer" key that is used in the getBaseline() method of BasicListUI. We need to fix BasicListUI to work the best it can wothout throwing a NPE if this key is missing. To do that we should change it to use a new instance of DefaultListCellRenderer if  the key is missing.
Posted Date : 2008-06-05 20:44:34.0
Comments
  
  Include a link with my name & email   

Submitted On 26-JUN-2008
gnoupi
This problem happens with HTML in Buttons, too, as well, getBaseline doesn't work. I called getBaseline on the JButton, with 10 and 10 as parameters, and i get this exception : 

Exception in thread "main" java.lang.IllegalArgumentException: Width and height must be >= 0
	at javax.swing.plaf.basic.BasicHTML.getHTMLBaseline(Unknown Source)
	at javax.swing.plaf.synth.SynthButtonUI.getBaseline(Unknown Source)
	at javax.swing.JComponent.getBaseline(Unknown Source)
	at FastTest.main(FastTest.java:34)



PLEASE NOTE: JDK6 is formerly known as Project Mustang