-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b86
-
generic
-
generic
Platforms: ALL
JDK: 5, 6, 7
(this CR filed against 7)
It is impossible to create a JTable instance when SynthLookAndFeel is installed in its initial configuration with default style factory. NullPointerException will be thrown.
The following code will throw NPE on JDK5, JDK6b105 and JDK7:
-------------------------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class Test {
public static void main(String[] args) throws UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new SynthLookAndFeel());
System.out.println("Current style factory: " + SynthLookAndFeel.getStyleFactory());
// NPE will be thrown:
new JTable();
}
}
-------------------------------------------------------------------------------------------
The output will be:
Current style factory: javax.swing.plaf.synth.DefaultSynthStyleFactory@587c94
Exception in thread "main" java.lang.NullPointerException
at javax.swing.JTable.setSelectionBackground(JTable.java:2550)
at javax.swing.plaf.synth.SynthTableUI.updateStyle(SynthTableUI.java:143)
at javax.swing.plaf.synth.SynthTableUI.installDefaults(SynthTableUI.java:121)
at javax.swing.plaf.basic.BasicTableUI.installUI(BasicTableUI.java:1391)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.JTable.setUI(JTable.java:3620)
at javax.swing.JTable.updateUI(JTable.java:3662)
at javax.swing.JTable.<init>(JTable.java:636)
at javax.swing.JTable.<init>(JTable.java:561)
at synth.Test.main(Test.java:12)
JDK: 5, 6, 7
(this CR filed against 7)
It is impossible to create a JTable instance when SynthLookAndFeel is installed in its initial configuration with default style factory. NullPointerException will be thrown.
The following code will throw NPE on JDK5, JDK6b105 and JDK7:
-------------------------------------------------------------------------------------------
import javax.swing.*;
import javax.swing.plaf.synth.SynthLookAndFeel;
public class Test {
public static void main(String[] args) throws UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(new SynthLookAndFeel());
System.out.println("Current style factory: " + SynthLookAndFeel.getStyleFactory());
// NPE will be thrown:
new JTable();
}
}
-------------------------------------------------------------------------------------------
The output will be:
Current style factory: javax.swing.plaf.synth.DefaultSynthStyleFactory@587c94
Exception in thread "main" java.lang.NullPointerException
at javax.swing.JTable.setSelectionBackground(JTable.java:2550)
at javax.swing.plaf.synth.SynthTableUI.updateStyle(SynthTableUI.java:143)
at javax.swing.plaf.synth.SynthTableUI.installDefaults(SynthTableUI.java:121)
at javax.swing.plaf.basic.BasicTableUI.installUI(BasicTableUI.java:1391)
at javax.swing.JComponent.setUI(JComponent.java:664)
at javax.swing.JTable.setUI(JTable.java:3620)
at javax.swing.JTable.updateUI(JTable.java:3662)
at javax.swing.JTable.<init>(JTable.java:636)
at javax.swing.JTable.<init>(JTable.java:561)
at synth.Test.main(Test.java:12)