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.
Steps to reproduce: - Create a JavaFX Script project - Download Substance LAF from https://substance.dev.java.net -> Get latest version - Add the substance.jar library to the project - Create a JavaFX Script file: ---------------------------------------------------------- import javafx.stage.*; import javafx.scene.*; import javafx.ext.swing.*; javax.swing.UIManager.setLookAndFeel("org.jvnet.substance.skin.SubstanceNebulaLookAndFeel"); Frame { title: "MyApplication" width: 200 height: 200 visible: true scene: Scene{ content: SwingButton { text: "Button" action: function() { } } } } ---------------------------------------------------------- - Enable the Preview There is an error in the output: UIDefaults.getUI() failed: no ComponentUI class for: com.sun.embeddedswing.EmbeddedPeer$Shell[,0,0,0x0,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=] java.lang.Error at javax.swing.UIDefaults.getUIError(UIDefaults.java:711) at javax.swing.MultiUIDefaults.getUIError(MultiUIDefaults.java:133) at javax.swing.UIDefaults.getUI(UIDefaults.java:741) at javax.swing.UIManager.getUI(UIManager.java:1016) at javax.swing.JPanel.updateUI(JPanel.java:109) at javax.swing.JPanel.<init>(JPanel.java:69) at javax.swing.JPanel.<init>(JPanel.java:78) at com.sun.embeddedswing.EmbeddedPeer$Shell.<init>(EmbeddedPeer.java:229) at com.sun.embeddedswing.EmbeddedPeer.<init>(EmbeddedPeer.java:69) at com.sun.scenario.scenegraph.SGComponent$SGEmbeddedPeer.<init>(SGComponent.java:160) at com.sun.scenario.scenegraph.SGEmbeddedToolkit.createEmbeddedPeer(SGEmbeddedToolkit.java:109) at com.sun.scenario.scenegraph.SGEmbeddedToolkit.createEmbeddedPeer(SGEmbeddedToolkit.java:48) at com.sun.embeddedswing.EmbeddedToolkit.embed(EmbeddedToolkit.java:64) at com.sun.scenario.scenegraph.SGComponent.setComponent(SGComponent.java:74) at javafx.ext.swing.SwingComponent.postInit$(SwingComponent.fx:219) at javafx.ext.swing.SwingAbstractButton.postInit$(SwingAbstractButton.fx:39) at javafx.ext.swing.SwingButton.postInit$(SwingButton.fx:32) at javafx.ext.swing.SwingButton.initialize$(SwingButton.fx:32) at javafxapplication20.Main.javafx$run$(Main.fx:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:166) at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:151) at org.netbeans.modules.javafx.preview.CodeUtils.run(CodeUtils.java:99) at org.netbeans.modules.javafx.preview.Preview$PreviewSideServer.body(Preview.java:378) at org.netbeans.modules.javafx.preview.Preview$PreviewSideServer$5.run(Preview.java:439) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:284) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
It is rather feature of this specific LAF. The problems are observed in case of applying another instance of this LAF loaded by another classloader. Standalone test sample: public static void main(String[] args) { try { EventQueue.invokeAndWait(new Runnable() { public void run() { try { URLClassLoader cl = new URLClassLoader(new URL[]{new URL("file:/c:/substance.jar")}); Thread.currentThread().setContextClassLoader(cl); Class lafClass = cl.loadClass("org.jvnet.substance.skin.SubstanceNebulaLookAndFeel"); UIManager.setLookAndFeel((LookAndFeel)lafClass.newInstance()); JDesktopPane jdp = new JDesktopPane(); JInternalFrame jif = new JInternalFrame("Prim1"); jif.setSize(200, 200); JButton button = new JButton("Button1"); jif.add(button); jdp.add(jif); JFrame fr = new JFrame("Prim1"); fr.setLayout(new BorderLayout()); fr.add(jdp); fr.setSize(300, 300); fr.setVisible(true); jif.setVisible(true); fr.repaint(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } }); EventQueue.invokeAndWait(new Runnable() { public void run() { try { URLClassLoader cl = new URLClassLoader(new URL[]{new URL("file:/c:/substance.jar")}); Thread.currentThread().setContextClassLoader(cl); Class lafClass = cl.loadClass("org.jvnet.substance.skin.SubstanceNebulaLookAndFeel"); UIManager.setLookAndFeel((LookAndFeel)lafClass.newInstance()); JDesktopPane jdp = new JDesktopPane(); JInternalFrame jif = new JInternalFrame("Prim2"); jif.setSize(200, 200); JButton button = new JButton("Button2"); jif.add(button); jdp.add(jif); JFrame fr = new JFrame("Prim2"); fr.setLayout(new BorderLayout()); fr.add(jdp); fr.setSize(300, 300); fr.setVisible(true); jif.setVisible(true); fr.repaint(); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } } }); } catch (Exception ex) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } }
verified