mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.13k stars 234 forks source link

Not working webLaf components in swing designer of Apache Netbeans IDE 12 #648

Closed ypkkhatri closed 3 years ago

ypkkhatri commented 3 years ago

Hello @mgarin,

I'm trying to configure WebLaf components in Apache Netbeans 12.0 swing designer, I have an old swing file (MainFrame.form) with WebLaf component WebSwitch but now if I'm opening in swing designer I'm getting the below error:

com.thoughtworks.xstream.converters.ConversionException: Included skin file "resources/label.xml" cannot be read! : Included skin file "resources/label.xml" cannot be read!
---- Debugging information ----
message             : Included skin file "resources/label.xml" cannot be read!
cause-exception     : com.alee.managers.style.StyleException
cause-message       : Included skin file "resources/label.xml" cannot be read!
class               : com.alee.managers.style.data.SkinInfo
required-type       : com.alee.managers.style.data.SkinInfo
converter-type      : com.alee.managers.style.data.SkinInfoConverter
path                : /skin
version             : not available
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1115)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1062)
    at com.alee.utils.XmlUtils.fromXML(XmlUtils.java:348)
    at com.alee.managers.style.skin.CustomSkin.<init>(CustomSkin.java:56)
    at com.alee.managers.style.skin.web.WebSkin.<init>(WebSkin.java:35)
    at com.alee.managers.style.StyleManager.getDefaultSkin(StyleManager.java:181)
    at com.alee.managers.style.StyleManager.getCurrentSkin(StyleManager.java:261)
    at com.alee.managers.style.StyleManager.applySkin(StyleManager.java:333)
    at com.alee.laf.panel.WebPanelUI.installUI(WebPanelUI.java:106)
    at javax.swing.JComponent.setUI(JComponent.java:666)
    at javax.swing.JPanel.setUI(JPanel.java:153)
    at com.alee.laf.panel.WebPanel.updateUI(WebPanel.java:1005)
    at javax.swing.JPanel.<init>(JPanel.java:86)
    at javax.swing.JPanel.<init>(JPanel.java:95)
    at com.alee.laf.panel.WebPanel.<init>(WebPanel.java:88)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:82)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:72)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:155)
    at org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:227)
    at org.netbeans.modules.form.RADComponent.initInstance(RADComponent.java:166)
    at org.netbeans.modules.form.GandalfPersistenceManager.restoreComponent(GandalfPersistenceManager.java:761)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadComponent(GandalfPersistenceManager.java:949)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:484)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:260)
    at org.netbeans.modules.form.FormEditor$2.run(FormEditor.java:327)
    at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:268)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:115)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.readAccess(NbMutexEventProvider.java:75)
    at org.netbeans.modules.openide.util.LazyMutexImplementation.readAccess(LazyMutexImplementation.java:71)
    at org.openide.util.Mutex.readAccess(Mutex.java:225)
    at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:251)
    at org.netbeans.modules.form.FormEditor.loadFormData(FormEditor.java:324)
    at org.netbeans.modules.nbform.FormEditorSupport.loadOpeningForm(FormEditorSupport.java:436)
    at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:256)
    at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:64)
    at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: com.alee.managers.style.StyleException: Included skin file "resources/label.xml" cannot be read!
    at com.alee.managers.style.data.SkinInfoConverter.unmarshal(SkinInfoConverter.java:175)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 63 more
java.io.IOException: Undefined component referenced in layout: webSwtch_Logo
    at org.netbeans.modules.form.layoutdesign.LayoutPersistenceManager.correctMissingName(LayoutPersistenceManager.java:712)
    at org.netbeans.modules.form.layoutdesign.LayoutPersistenceManager.loadLayout(LayoutPersistenceManager.java:388)
    at org.netbeans.modules.form.layoutdesign.LayoutPersistenceManager.loadContainer(LayoutPersistenceManager.java:354)
    at org.netbeans.modules.form.layoutdesign.LayoutModel.loadContainerLayout(LayoutModel.java:1206)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadComponent(GandalfPersistenceManager.java:979)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:484)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:260)
    at org.netbeans.modules.form.FormEditor$2.run(FormEditor.java:327)
    at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:268)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:115)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.readAccess(NbMutexEventProvider.java:75)
    at org.netbeans.modules.openide.util.LazyMutexImplementation.readAccess(LazyMutexImplementation.java:71)
    at org.openide.util.Mutex.readAccess(Mutex.java:225)
    at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:251)
    at org.netbeans.modules.form.FormEditor.loadFormData(FormEditor.java:324)
    at org.netbeans.modules.nbform.FormEditorSupport.loadOpeningForm(FormEditorSupport.java:436)
    at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:256)
    at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:64)
    at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Can you please guide me solution or do you have any idea what's wrong with that?

Regards,

Yougeshwar Khatri

mgarin commented 3 years ago

Unfortunately I'm not working with NetBeans, so I don't know for sure what could have caused it.

The log you provided seem to have two potentially unrelated stack traces. I have no idea about the NetBeans one, but the one from WebLaF indicates that something went wrong during reading the skin. Can't really tell more because important part of the stack trace is missing.

If this only started happening after switching to NetBeans 12 - my guess is that the mix of older WebLaF version & newer Java version might be the culprit. If that is the case - it's important for me to know:

ypkkhatri commented 3 years ago

Thanks for responding to the ticket, first for all I totally know that you are not working with Netbeans otherwise this library would be part of Netbeans. I really appreciate your efforts in this library, which makes a lot of things easier for desktop applications.

Below are the versions I'm using:

For information, Apache Netbeans 12 supports Java 8 development.

mgarin commented 3 years ago

Just to make sure - is that Java version which NetBeans itself uses to run? Because the NetBeans Java version is what matters in that case since WebLaF gets loaded by NetBeans to be displayed in the UI designer.

mgarin commented 3 years ago

Overall - I'll try to check this tomorrow since there might be some other possible issues (even with newer WebLaF versions).

ypkkhatri commented 3 years ago

@mgarin I have just checked in Java platform: image

mgarin commented 3 years ago

That is your project JDK, not JVM that NetBeans uses to run. NetBeans itself is also a Java application, it matters which JVM version it's using for this particular case.

mgarin commented 3 years ago

I've just installed Apache NetBeans 12.1 to check - it seem to be using JRE 15:

Product Version: Apache NetBeans IDE 12.1
Java: 15; Java HotSpot(TM) 64-Bit Server VM 15+36-1562
Runtime: Java(TM) SE Runtime Environment 15+36-1562

In which case the issue you're experiencing is expected.

First of all the WebLaF version you're using - 1.2.9 - didn't have a lot of critical fixes for Java 9+ and Java 12+, so it simply won't run under JRE 9+. To fix this you need to use newer WebLaF version. I don't remember exactly in which update I've added Java 12+ support - it was either 1.2.10 or 1.2.11 - but it is worth upgrading to the latest 1.2.13 since it contains all of the latest fixes and improvements.

Second - under Java 9+ certain JVM options have to be provided for WebLaF to function correctly in case illegal-access property is set to deny. I'm not sure which JVM options NetBeans uses exactly, my guess is that it probably uses default warn so besides warning in the log it shouldn't cause any issues. For more information I recommend reading this wiki article: https://github.com/mgarin/weblaf/wiki/Java-9-and-higher


And again, I want to emphasize that in case you're using WebLaF in the NetBeans UI designer your project JDK doesn't matter because WebLaF gets loaded by NetBeans using JVM on which NetBeans is running. And as I mentioned above it is most probably JRE 15 in case of Apache NetBeans 12.1, unless you reconfigured it to run on a different JRE.

ypkkhatri commented 3 years ago

That is your project JDK, not JVM that NetBeans uses to run. NetBeans itself is also a Java application, it matters which JVM version it's using for this particular case.

That also using the same Java, when I have installed it I have selected the same java version

mgarin commented 3 years ago

That also using the same Java, when I have installed it I have selected the same java version

That is weird, I didn't really see an option to select JVM during install. Can you confirm which version your NetBeans is running on by checking about dialog? It's in the menu -> Help -> About:

image

ypkkhatri commented 3 years ago

Please check my Netbeans JRE version image

mgarin commented 3 years ago

I'll try WebLaF out under that specific JDK version, maybe there are some new issues I'm unaware of.

While I do that, can you check if newest WebLaF version fixes this issue for you? Or does 1.2.9 work properly for you outside of the UI designer?

ypkkhatri commented 3 years ago

It works fine outside the UI designer but not loading the UI designer in Netbeans, and I will try with the latest version and update here.

ypkkhatri commented 3 years ago

@mgarin I tried the latest version of WebLaf but the issue is the same. But I see that also looks in path/skin/style/ui/drawShade:

12:34:04.298 | com.thoughtworks.xstream.converters.ConversionException: Included skin file "resources/label.xml" cannot be read! : Included skin file "resources/label.xml" cannot be read!
---- Debugging information ----
message             : Included skin file "resources/label.xml" cannot be read!
cause-exception     : com.alee.managers.style.StyleException
cause-message       : Included skin file "resources/label.xml" cannot be read!
class               : com.alee.managers.style.data.SkinInfo
required-type       : com.alee.managers.style.data.SkinInfo
converter-type      : com.alee.managers.style.data.SkinInfoConverter
path                : /skin
version             : not available
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: Included skin file "resources/label.xml" cannot be read! : Included skin file "resources/label.xml" cannot be read!
---- Debugging information ----
message             : Included skin file "resources/label.xml" cannot be read!
cause-exception     : com.alee.managers.style.StyleException
cause-message       : Included skin file "resources/label.xml" cannot be read!
class               : com.alee.managers.style.data.SkinInfo
required-type       : com.alee.managers.style.data.SkinInfo
converter-type      : com.alee.managers.style.data.SkinInfoConverter
path                : /skin
version             : not available
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1115)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1062)
    at com.alee.utils.XmlUtils.fromXML(XmlUtils.java:348)
    at com.alee.managers.style.skin.CustomSkin.<init>(CustomSkin.java:56)
    at com.alee.managers.style.skin.web.WebSkin.<init>(WebSkin.java:35)
    at com.alee.managers.style.StyleManager.getDefaultSkin(StyleManager.java:181)
    at com.alee.managers.style.StyleManager.getCurrentSkin(StyleManager.java:261)
    at com.alee.managers.style.StyleManager.applySkin(StyleManager.java:333)
    at com.alee.laf.panel.WebPanelUI.installUI(WebPanelUI.java:106)
    at javax.swing.JComponent.setUI(JComponent.java:666)
    at javax.swing.JPanel.setUI(JPanel.java:153)
    at com.alee.laf.panel.WebPanel.updateUI(WebPanel.java:1000)
    at javax.swing.JPanel.<init>(JPanel.java:86)
    at javax.swing.JPanel.<init>(JPanel.java:95)
    at com.alee.laf.panel.WebPanel.<init>(WebPanel.java:88)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:82)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:72)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:155)
    at org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:227)
    at org.netbeans.modules.form.RADComponent.initInstance(RADComponent.java:166)
    at org.netbeans.modules.form.GandalfPersistenceManager.restoreComponent(GandalfPersistenceManager.java:761)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadComponent(GandalfPersistenceManager.java:949)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:484)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:260)
    at org.netbeans.modules.form.FormEditor$2.run(FormEditor.java:327)
    at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:268)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:115)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.readAccess(NbMutexEventProvider.java:75)
    at org.netbeans.modules.openide.util.LazyMutexImplementation.readAccess(LazyMutexImplementation.java:71)
    at org.openide.util.Mutex.readAccess(Mutex.java:225)
    at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:251)
    at org.netbeans.modules.form.FormEditor.loadFormData(FormEditor.java:324)
    at org.netbeans.modules.nbform.FormEditorSupport.loadOpeningForm(FormEditorSupport.java:436)
    at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:256)
    at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:64)
    at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: com.alee.managers.style.StyleException: Included skin file "resources/label.xml" cannot be read!
    at com.alee.managers.style.data.SkinInfoConverter.unmarshal(SkinInfoConverter.java:175)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 63 common frames omitted
12:34:04.336 | com.thoughtworks.xstream.converters.ConversionException: null : null
---- Debugging information ----
cause-exception     : java.lang.NullPointerException
cause-message       : null
class               : com.alee.managers.style.data.ComponentStyle
required-type       : com.alee.managers.style.data.ComponentStyle
converter-type      : com.alee.managers.style.data.ComponentStyleConverter
path                : /skin/style/ui/drawShade
class[1]            : com.alee.managers.style.data.SkinInfo
converter-type[1]   : com.alee.managers.style.data.SkinInfoConverter
version             : not available
-------------------------------
com.thoughtworks.xstream.converters.ConversionException: null : null
---- Debugging information ----
cause-exception     : java.lang.NullPointerException
cause-message       : null
class               : com.alee.managers.style.data.ComponentStyle
required-type       : com.alee.managers.style.data.ComponentStyle
converter-type      : com.alee.managers.style.data.ComponentStyleConverter
path                : /skin/style/ui/drawShade
class[1]            : com.alee.managers.style.data.SkinInfo
converter-type[1]   : com.alee.managers.style.data.SkinInfoConverter
version             : not available
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.alee.managers.style.data.SkinInfoConverter.unmarshal(SkinInfoConverter.java:141)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1049)
    at com.alee.utils.XmlUtils.fromXML(XmlUtils.java:336)
    at com.alee.utils.XmlUtils.fromXML(XmlUtils.java:449)
    at com.alee.managers.style.data.SkinInfoConverter.loadSkinInfo(SkinInfoConverter.java:245)
    at com.alee.managers.style.data.SkinInfoConverter.unmarshal(SkinInfoConverter.java:172)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1185)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1169)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1115)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1062)
    at com.alee.utils.XmlUtils.fromXML(XmlUtils.java:348)
    at com.alee.managers.style.skin.CustomSkin.<init>(CustomSkin.java:56)
    at com.alee.managers.style.skin.web.WebSkin.<init>(WebSkin.java:35)
    at com.alee.managers.style.StyleManager.getDefaultSkin(StyleManager.java:181)
    at com.alee.managers.style.StyleManager.getCurrentSkin(StyleManager.java:261)
    at com.alee.managers.style.StyleManager.applySkin(StyleManager.java:333)
    at com.alee.laf.panel.WebPanelUI.installUI(WebPanelUI.java:106)
    at javax.swing.JComponent.setUI(JComponent.java:666)
    at javax.swing.JPanel.setUI(JPanel.java:153)
    at com.alee.laf.panel.WebPanel.updateUI(WebPanel.java:1005)
    at javax.swing.JPanel.<init>(JPanel.java:86)
    at javax.swing.JPanel.<init>(JPanel.java:95)
    at com.alee.laf.panel.WebPanel.<init>(WebPanel.java:88)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:82)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:72)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:155)
    at org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:227)
    at org.netbeans.modules.form.RADComponent.initInstance(RADComponent.java:166)
    at org.netbeans.modules.form.GandalfPersistenceManager.restoreComponent(GandalfPersistenceManager.java:761)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadComponent(GandalfPersistenceManager.java:949)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:484)
    at org.netbeans.modules.form.GandalfPersistenceManager.loadForm(GandalfPersistenceManager.java:260)
    at org.netbeans.modules.form.FormEditor$2.run(FormEditor.java:327)
    at org.netbeans.modules.form.FormLAF$2.run(FormLAF.java:268)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.doEventAccess(NbMutexEventProvider.java:115)
    at org.netbeans.modules.openide.util.NbMutexEventProvider$Event.readAccess(NbMutexEventProvider.java:75)
    at org.netbeans.modules.openide.util.LazyMutexImplementation.readAccess(LazyMutexImplementation.java:71)
    at org.openide.util.Mutex.readAccess(Mutex.java:225)
    at org.netbeans.modules.form.FormLAF.executeWithLookAndFeel(FormLAF.java:251)
    at org.netbeans.modules.form.FormEditor.loadFormData(FormEditor.java:324)
    at org.netbeans.modules.nbform.FormEditorSupport.loadOpeningForm(FormEditorSupport.java:436)
    at org.netbeans.modules.nbform.FormDesignerTC.loadForm(FormDesignerTC.java:256)
    at org.netbeans.modules.nbform.FormDesignerTC.access$300(FormDesignerTC.java:64)
    at org.netbeans.modules.nbform.FormDesignerTC$PreLoadTask$1.run(FormDesignerTC.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NullPointerException: null
    at com.alee.utils.ReflectUtils.getFieldImpl(ReflectUtils.java:308)
    at com.alee.utils.ReflectUtils.getField(ReflectUtils.java:283)
    at com.alee.utils.ReflectUtils.getFieldType(ReflectUtils.java:245)
    at com.alee.utils.ReflectUtils.getFieldTypeSafely(ReflectUtils.java:222)
    at com.alee.managers.style.data.ComponentStyleConverter.readProperty(ComponentStyleConverter.java:317)
    at com.alee.managers.style.data.ComponentStyleConverter.unmarshal(ComponentStyleConverter.java:204)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 81 common frames omitted
mgarin commented 3 years ago

That is a complete stack trace though, this will be helpful, thanks!

mgarin commented 3 years ago

I was pretty sure I made a solution for the backwards initialization for UI designers, but it might not be working correctly (or something else got broken), so I'll have to properly investigate this.

ypkkhatri commented 3 years ago

That's cool, thanks for quick response, looking forward

mgarin commented 3 years ago

Unfortunately, no good news. I've looked into possible solutions for this and there are no easy & quick ways to hook up mangers initialization, so this will probably go to a later update due to the scope of changes needed - pretty much every custom component needs to be able to invoke static managers initialization, but even then there will be some case-specific issues with some components relying on UI defaults.

Also I completely forgot that this was actually a recorded enhancement which I never got to implementing: #18

mgarin commented 3 years ago

I know this might be a deal breaker for you (and some other developers who prefer using UI designer), but unfortunately I don't think I'll be able to implement this in the nearest updates due to the scope of the changes needed.

I'll close this issue since it's a duplicate of #18 - you can follow it instead to receive updates

ypkkhatri commented 3 years ago

Thanks for the update, but I don't see reason to close the ticket, that's addressing different problem. I would suggest you to keep it open. Otherwise closed without any solution making no sense.

mgarin commented 3 years ago

That is the point - it's not a different problem. Exception you're seeing is happening exactly because initialization of the managers is not happening before component (WebSwitch in your case) is instantiated. That is exactly what issue #18 is about, it just doesn't have a very detailed explanation.

mgarin commented 3 years ago

You're using WebLaF v1.2.9 where this exception was unchecked, in newer versions you will see something like this:

Exception in thread "main" com.alee.managers.style.StyleException: StyleManager must be initialized first
    at com.alee.managers.style.StyleManager.mustBeInitialized(StyleManager.java:607)
    at com.alee.managers.style.StyleManager.getDescriptor(StyleManager.java:719)
    at com.alee.managers.style.StyleManager.getDescriptor(StyleManager.java:705)
    at com.alee.laf.panel.WebPanel.updateUI(WebPanel.java:1045)
    at java.desktop/javax.swing.JPanel.<init>(JPanel.java:86)
    at java.desktop/javax.swing.JPanel.<init>(JPanel.java:95)
    at com.alee.laf.panel.WebPanel.<init>(WebPanel.java:121)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:103)
    at com.alee.extended.button.WebSwitch.<init>(WebSwitch.java:72)

But it is basically the same problem.

mgarin commented 3 years ago

Or am I missing something?

Just a note - the issue is the same for any UI designer in any IDE/version since they pretty much all use the same approach to component instantiation and usage, so whether it's IntelliJ Idea, NetBeans or any other application's UI designer - the problem would be the same for all of them.

ypkkhatri commented 3 years ago

@mgarin Looks like the #18 is opened in 2013 (almost 8 years old). So do you have any plan for the solution?

mgarin commented 3 years ago

@ypkkhatri I do have a plan, but unfortunately that issue have never been a priority, so I have delayed it multiple times over the years. And overall due to my current overload with other projects I have delayed other planned changes for the library as well.

Also the fix for this problem is not as simple as it might seem and have to be done carefully, so I'd rather add it in a separate update to ensure it works properly and doesn't break any other library use-cases, which means it won't be coming at least until after v1.3.0 update, for which I still have some work to finish.