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 133756 - Adapt samples to show them in preview and running as Applets
Summary: Adapt samples to show them in preview and running as Applets
Status: VERIFIED WORKSFORME
Alias: None
Product: usersguide
Classification: Unclassified
Component: JavaFX (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Michal Skvor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-23 12:15 UTC by Alexandr Scherbatiy
Modified: 2008-06-26 10:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ColorWheel example and Preview (81.91 KB, image/png)
2008-04-25 11:25 UTC, Alexandr Scherbatiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Scherbatiy 2008-04-23 12:15:49 UTC
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" }
 }
 -------------------------------------
Comment 1 Michal Skvor 2008-04-25 07:54:29 UTC
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.
Comment 2 Alexandr Scherbatiy 2008-04-25 09:19:07 UTC
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 
Comment 3 Michal Skvor 2008-04-25 10:32:26 UTC
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.
Comment 4 Alexandr Scherbatiy 2008-04-25 11:23:08 UTC
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.
Comment 5 Alexandr Scherbatiy 2008-04-25 11:25:09 UTC
Created attachment 60683 [details]
ColorWheel example and Preview
Comment 6 Alexandr Scherbatiy 2008-06-25 11:09:33 UTC
Preview is bale to show frames that are not at the end of file now.
Comment 7 Alexandr Scherbatiy 2008-06-26 10:49:12 UTC
verified