This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 204569

Summary: [71cat] NullPointerException at com.jtattoo.plaf.BaseSliderUI.paintThumb
Product: guibuilder Reporter: MackSix
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED WONTFIX    
Severity: normal CC: asenk
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 182513
Attachments: stacktrace
Project that exhibits the error.

Description MackSix 2011-11-02 10:10:57 UTC
Build: NetBeans IDE Dev (Build 201110310600)
VM: Java HotSpot(TM) Client VM, 21.1-b02, Java(TM) SE Runtime Environment, 1.7.0_01-b08
OS: Windows Vista

User Comments:
MackSix: Applying custom Look and Feel per http://wiki.netbeans.org/TS_61_componetinspector#Test_suite:_Testing_various_Previews




Stacktrace: 
java.lang.NullPointerException
   at com.jtattoo.plaf.BaseSliderUI.paintThumb(BaseSliderUI.java:0)
   at com.jtattoo.plaf.BaseSliderUI.paint(BaseSliderUI.java:0)
   at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
   at javax.swing.JComponent.paintComponent(JComponent.java:778)
   at javax.swing.JComponent.paint(JComponent.java:1054)
   at javax.swing.JComponent.paintChildren(JComponent.java:887)
Comment 1 MackSix 2011-11-02 10:11:06 UTC
Created attachment 112721 [details]
stacktrace
Comment 2 MackSix 2011-11-02 10:16:31 UTC
Should I just give up trying to test these Look and Feels?
Comment 3 MackSix 2011-11-02 10:44:31 UTC
Created attachment 112727 [details]
Project that exhibits the error.

See Item 6. in
http://wiki.netbeans.org/TS_61_componetinspector#Test_suite:_Testing_various_Previews

Use http://wiki.netbeans.org/wiki/images/2/27/JTattoo.jar and install the
twelve entries that have "LookAndFeel" in the names. (there are 12 of them)

1. Install the custom look and feels from JTattoo.jar
2. Open attached Project.
2. Right click on JFrame in Navigator and choose Preview Design and then choose
a LookAndFeel. 
3. Close running program and choose a LookAndFeel again.

This Exception is thrown.
Comment 4 Jan Stola 2011-11-02 13:04:47 UTC
Swing API doesn't allow to use several look and feels at once. Hence, the ability to preview the form in a different look and feel is just an error-prone set of hacks that attempt to show the form as it would look in a different look and feel. This functionality can be inaccurate. It is present because it works somehow for the basic look and feels and it may work well for some other look and feels, but it doesn't (and cannot work) in general for any look and feel.

I am closing this issue as 'will not fix' because it is not worth the effort to introduce even more error-prone hacks to support non-standard look and feel.
Comment 5 Jan Stola 2011-11-03 09:27:49 UTC
The attached exception is thrown by the code that paints thumb of JSlider. The corresponding UI class of JTattoo look and feel (BaseSliderUI) paints the thumb as an icon. Unfortunately, the icon is null. The code that returns the icon doesn't follow standards for look and feels: it checks explicitly what look and feel is set (using UIManager.getLookAndFeel()) and it gets the icon from the returned look and feel directly (using getIconFactory().get<iconType>) instead of using UIDefaults.

We don't modify look and feel field in UIManager during preview. Our preview in other look and feel is based on smart manipulation of UIDefaults. Hence, this bug cannot be fixed unless we rewrite the preview support completely (to use a different kind of hacks).

In other words, preview (in JTattoo look and feel) of a form that contains JSlider will always throw the mentioned exception.
Comment 6 asenk 2011-11-03 09:38:30 UTC
Wouldn't be better to remove custom L&Fs from Preview Design?
Comment 7 Jan Stola 2011-11-03 10:07:28 UTC
> Wouldn't be better to remove custom L&Fs from Preview Design?

Why so? Because it doesn't work with poorly designed look and feels? Why not to extrapolate that: shouldn't we remove the possibility to add custom component into GUI Builder because they can throw exceptions when they are poorly designed? ;o)

I guess you can see the point - it is beneficial when it works. It doesn't make sense to remove some functionality because it isn't 100% bug-free/reliable/accurate. We would end up with an almost no-op IDE otherwise.