-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta2
-
x86
-
windows_2000
-
Verified
Name: boT120536 Date: 06/03/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
Adding a JButton to a JToolBar where JButton does not have a Border fails.
The following code:
JToolbar toolbar = new JToolBar();
JButton button = new JButton("text");
button.setBorder(null);
toolbar.add(button);
throws:
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:380)
at javax.swing.plaf.basic.BasicToolBarUI.setBorderToNonRollover(BasicToolBarUI.java:620)
at javax.swing.plaf.basic.BasicToolBarUI$ToolBarContListener.componentAdded(BasicToolBarUI.java:1004)
at java.awt.Container.processContainerEvent(Container.java:1355)
at java.awt.Container.processEvent(Container.java:1334)
at java.awt.Component.dispatchEventImpl(Component.java:3476)
at java.awt.Container.dispatchEventImpl(Container.java:1399)
at java.awt.Component.dispatchEvent(Component.java:3343)
at java.awt.Container.addImpl(Container.java:502)
at javax.swing.JToolBar.addImpl(JToolBar.java:536)
at java.awt.Container.add(Container.java:321)
at javabugs.Frame.<init>(Frame.java:37)
...
As far as I have seen, this happens because jdk1.4 now tries to store the
original border of buttons due to the new "Rollover" feature (in
javax.swing.plaf.basic.BasicToolBarUI).
This fails if the border is null, because it is stored in a
java.util.Hashtable, and this doesn't allow null values.
(Review ID: 125697)
======================================================================