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 Best Practices -> Color -> Linear Gradient sample - Enable the Preview The sample shown in separate window ( see issue 133091 ) To show sample in the Preview it needs to declare at the end of file or return frame at the of file. For example: ------------------------------------- var frame = Frame{ } // code frame; ------------------------------------- or ------------------------------------- // code Frame{ } ------------------------------------- The sample should be an instance of Application to show it as Applet: ------------------------------------- Application { content: Label { text:"Hello World" } } -------------------------------------
The problem is not in samples but in preview. Imagine ordinary script developer who is trying to write something in the script that he must put visible object somewhere at the end to see product of his work and maybe he won't. Hacks like return something at the end are ridiculous and force developer to make ugly code. What if user wants to return two frames and not one to create MDA application? Even when I place my object as last it does not automatically means that the frame or other visible object will be shown in the preview window. And last but not least. Application does not work at all. Preview and run does not show window and I can't set title in Application.
The main problem is in JavaFX Script compiler. See JFXC-1121 http://openjfx.java.sun.com/jira/browse/JFXC-1121 The problem is that compiler returns only last statement from file. So the suggestion is to move a Frame declaration at the end of file for samples. The following code does not look very ugly: ------------------------------------- // code Frame{ } ------------------------------------- If you have Applet examples that uses javafx.ui library then they can be converted to Reprise applets using javafx.gui.Application class
It does not solve this problem for all demos. Try for example ColorWheel. Move Frame from beginning to the end. It should be working but it does not. Even when you do this: // code // last things in file var f = Frame {}; return f; // <-- this is the last line of fx file > If you have Applet examples that uses javafx.ui library > then they can be converted to Reprise applets using javafx.gui.Application class All demos are rewritten to Reprise so they utilizing javafx.gui classes. Changing javafx.gui.Frame to javafx.gui.Application causes no visible application ( either in preview or run ) at all.
The ColorWheel is shown in preview for me. See the attached screen-shot. Ok. Do not use javafx.gui.Application class. It is designed only for applet support now.
Created attachment 60683 [details] ColorWheel example and Preview
Preview is bale to show frames that are not at the end of file now.
verified