JavaFX Script: Difference between revisions

Content deleted Content added
BOT--Reverting link addition(s) by 150.204.129.43 to revision 499831935 (https://www.packtpub.com/javafx-1-2-application-development-cookbook/book, https://www.packtpub.com/javafx-1-2-application-develo...
 
(48 intermediate revisions by 32 users not shown)
Line 2:
{{Infobox programming language
| name = JavaFX
| logo = [[File:JavaFX Logo.png]]
| logo size = size : 24220px
| developer = [[Sun Microsystems]]
| latest release version = 1.2
| latest release date = {{releasestart date|2009|06|02}}
| latest preview version =
| latest preview date =
Line 13 ⟶ 14:
| website = http://javafx.com/
}}
'''JavaFX Script''' is a [[scripting language]] designed by [[Sun Microsystems]], forming part of the [[JavaFX]] family of technologies on the [[Java Platform]].
 
'''JavaFX targetsScript''' was a [[scripting language]] designed by [[Sun Microsystems]], forming part of the [[JavaFX]] family of technologies on the [[Java Platform]].

JavaFX targeted the [[Rich Internet Application]] ___domain (competing with [[Adobe Flex]] and [[Microsoft Silverlight]]), specializing in rapid development of visually rich applications for the desktop and mobile markets. JavaFX Script works with [[integrated development environment]]s such as [[NetBeans]] and, [[Eclipse (software)|Eclipse]]. and [[IntelliJ IDEA]]. JavaFX is released under the [[GNU General Public License]], via the Sun sponsored [https://openjfx.dev.java.net [OpenJFX]] project].
 
==History==
Line 23 ⟶ 25:
Its name was changed to JavaFX Script, and it became [[open source]]d at [[JavaOne]] 2007.
 
<!-- All the code, documentation and demos are shared in the [https://openjfx.dev.java.net/ Project OpenJFX] Development Website. (This is no more the case)-->JavaFX 1.0 was released on December 4, 2008.<ref>[{{Cite web|url=http://www.sun.com/aboutsun/pr/2008-12/sunflash.20081204.1.xml|title=Sun Microsystems Unveils JavaFX 1.0 releasedwith Immersive Media Capabilities Targeted at Market's 800 Million Java Powered Desktops|lang=en|date=2008-12-04}}</ref> On September 10, 2010 Oracle announced at [[JavaOne]] that JavaFX Script would be discontinued, although the JavaFX API would be made available to other languages for the Java Virtual Machine.<ref>[http://javafx.com/roadmap/ JavaFX 2010-2011 Roadmap] {{webarchive|url=https://web.archive.org/web/20101029215752/http://javafx.com/roadmap/ |date=2010-10-29 }}</ref>
 
On September 27, 2010 Stephen Chin announced Visage a declarative user-interface language based on the JavaFX Script with enhancements.<ref>{{cite web |url=http://steveonjava.com/accouncing-visage/ |title=Steve On Java » Announcing Visage – The DSL for Writing UIs |website=steveonjava.com |url-status=dead |archive-url=https://web.archive.org/web/20101001193810/http://steveonjava.com/accouncing-visage |archive-date=2010-10-01}} </ref>
On September 10, 2010 Oracle announced at [[JavaOne]] that JavaFX Script would be discontinued, although the JavaFX API would be made available to other languages for the Java Virtual Machine.<ref>[http://javafx.com/roadmap/ JavaFX 2010-2011 Roadmap]</ref>
 
On April 8, 2012 a project was created with the intention of resurrecting and enhancing the original F3 programming language, but the project appears to have been discontinued in August 2015.<ref>{{Citation |last=unktomi |title=unktomi/form-follows-function |date=2022-07-31 |url=https://github.com/unktomi/form-follows-function |access-date=2023-03-30}}</ref>
On September 27, 2010 Stephen Chin announced [[Visage (programming language)|Visage]] a declarative user-interface language based on the JavaFX script with enhancements.<ref>http://steveonjava.com/accouncing-visage/</ref>
 
== Features ==
JavaFX Script iswas a compiled, [[Type system#Static typing|statically typed]], [[Declarative programming language|declarative]], [[scripting language]] for the [[Java Platform]]. It providesprovided automatic data-binding, [[mutation trigger]]s and [[declarative animation]], using an expression language syntax (all code blocks potentially yield values.)
 
Through its standard [[JavaFX]] APIs it supportssupported [[retained mode]] vector graphics, video playback and standard [[Swing (Java)|Swing]] components.
 
Although F3 began life as an [[interpreted language]], prior to the first preview release (Q3 2008) JavaFX Script had shifted focus to being predominantly compiled. Interpreted JavaFX Script is still possible, via the [[JSR 223]] 'Scripting for Java' bridge. Because it is built on top of the [[Java Platform]], it is easy to use [[Java (programming language)|Java]] classes in JavaFX Script code. Compiled JavaFX Script iswas able to run on any platform whichthat has a recent [[Java Runtime Environment|Java Runtime]] installed.
 
== Syntax ==
[[JavaFX]] Script's declarative syntaxstyle for constructing user interfaces contrastscan sharplyprovide withshorter and more readable source code than the more verbose series of method calls required to construct an equivalent interface if written in [[SwingJavaFX Script's (Java)|Swing]]procedural directlystyle.
 
Here is a simple [[Hello world program]] for JavaFX Script :
<syntaxhighlight lang="java">
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
 
Stage {
import javafx.stage.Stage;
contenttitle: "Hello World"
import javafx.scene.Scene;
width: 250
import javafx.scene.text.Text;
height: 80
import javafx.scene.text.Font;
scene: Scene {
xcontent: 10, y:Text 30{
Stage {
title font : "HelloFont World"{
width size : 25024
height: 80 }
scene x: Scene10, y: {30
content: Text"Hello {World"
font : Font {}
}
size : 24
}
}
</syntaxhighlight>
x: 10, y: 30
It shows the following window/frame :
content: "Hello World"
}
}
}
 
It shows the following window/frame :
 
[[File:HelloWorld Java FX.jpg|260px]]
 
This program can also be written in JavaFX Script using a procedural style this way:
<syntaxhighlight lang="java">
import javafx.extstage.swing.*Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
 
var myFont: Font = Font.font(null, 24);
import javafx.ext.swing.*;
var myFrame:SwingFrame = new SwingFrame();
var myLabel:Label = new Label();
myLabel.text = "Hello World!";
myFrame.width = 200;
myFrame.height = 50;
myFrame.visible = true;
myFrame.content = myLabel;
 
var myLabelmyText:Label Text = new LabelText();
==Prerequisites==
myText.font = myFont;
Java SE 5 or above is required to support JavaFX Script development. Developers may work with JavaFX Script using the [[Eclipse (software)|Eclipse]] or [[NetBeans]] IDEs by incorporating the necessary plugins.
myText.x = 10;
myText.y = 30;
myText.content = "Hello World";
 
var myScene:Scene = new Scene();
myFramemyScene.content = myLabelmyText;
 
var myStage: Stage = new Stage();
myLabelmyStage.texttitle = "Hello World!";
myFramemyStage.width = 200250;
myFramemyStage.height = 5080;
myStage.scene = myScene;
</syntaxhighlight>
 
== See also ==
{{Portal|JavaComputer programming|Free and open-source software}}
* [[Java applet]], a means of deploying Java applications inside a web page.
* [[JavaFX]], a family of products and technologies intended to be used to create [[Rich Internet application|Rich Internet Applications (RIAs)]].
Line 98 ⟶ 109:
| date = November 23, 2009
| title = JavaFX in Action
| publisher = [[Manning Publications|Manning]]
| pages = 375
| isbn = 978-1-933988-99-13
| url =
}}
* {{citation
| first1 = Kim
| last1 = Topley
| date = October 12, 2009
| title = JavaFX Developer's Guide
| publisher = [[Addison-Wesley Professional]]
| pages = 640
| isbn = 978-0-321-60165-30
| url = http://www.informit.com/store/product.aspx?isbn=0321648978
}}
* {{citation
| first1 = James L.
| last1 = Weaver
| first2 = Weiqi
| last2 = Gao
| first3 = Stephen
| last3 = Chin
| first4 = Dean
| last4 = Iverson
| date = June 22, 2009
| title = Pro JavaFX Platform: Script, Desktop and Mobile RIA with Java Technology
| publisher = [[Apress]]
| pages = 500
| isbn = 978-1-4302-1875-43
| url = http://www.apress.com/book/view/1430218754
|access-date = August 2, 2009
|archive-date = August 15, 2009
|archive-url = https://web.archive.org/web/20090815082457/http://apress.com/book/view/1430218754
|url-status = dead
}}
* {{citation
| first1 = Jim
| last1 = Clarke
| first2 = Jim
| last2 = Connors
| first3 = Eric
| last3 = J. Bruno
| date = June 15, 2009
| title = JavaFX: Developing Rich Internet Applications
| publisher = [[Prentice Hall]]
| pages = 384
| isbn = 978-0-13-701287-X9
| url = http://www.informit.com/store/product.aspx?isbn=0137013531
}}
* {{citation
| first1 = Gail
| last1 = Anderson
| first2 = Paul
| last2 = Anderson
| date = June 15, 2009
| title = Essential JavaFX
| publisher = [[Prentice Hall]]
| pages = 360
| isbn = 978-0-13-704279-51
| url = http://www.informit.com/store/product.aspx?isbn=0137042795
}}
* {{citation
| first = James L.
| last = Weaver
| date = May 4, 2009
| title = JavaFX Script: Dynamic Java Scripting for Rich Internet/Client-side Applications
| publisher = [[Apress]]
| pages = 200
| isbn = 978-1-59059-945-47
| url = http://www.apress.com/book/view/1590599454
| access-date = August 2, 2009
| archive-date = March 23, 2012
| archive-url = https://web.archive.org/web/20120323194640/http://www.apress.com/book/view/1590599454
| url-status = dead
}}
{{refend}}
 
==External links==
* [http://javafx.com/ JavaFX Main Site] {{Webarchive|url=https://web.archive.org/web/20110713091051/http://javafx.com/ |date=2011-07-13 }}
* [http://www.sun.com/software/javafx/index.jsp Sun's JavaFX overview]
* [http://blogs.sunoracle.com/chrisoliver/category/F3 Chris Oliver's blog, F3 category] {{Webarchive|url=https://web.archive.org/web/20131212225219/https://blogs.oracle.com/chrisoliver/category/F3 |date=2013-12-12 }}
* [http://learnjavafx.typepad.com James Weaver's Learn JavaFX Weblog]
* [http://java.sun.com/developer/technicalArticles/scripting/javafxpart1/ Sun.com - Learning JavaFX Script: An Introduction for Java Programmers]
* [httphttps://www.nytimes.com/2007/05/08/technology/08sun.html Sun Plans Version of Java for Web-Linked Cellphones] ([[New York Times]] article)
* [{{webarchive |date=2013-01-19 |url=https://archive.today/20130119171232/http://news.com.com/Sun+tries+again+with+consumer-flavored+Java/2100-1007_3-6181922.html |title=Sun tries again with consumer-flavored Java]}} ([[CNET]] article)
* [http://jfx.wikia.com/wiki/Main_Page Planet JFX Community Wiki] (how-to's, code samples, tutorials)
{{Sun Microsystems}}
 
{{DEFAULTSORT:JavafxJavaFX Script}}
[[Category:Scripting languages]]
[[Category:Declarative programming languages]]
[[Category:Java programming language family]]
[[Category:JVM programming languages]]
[[Category:Scripting languages]]
 
[[fr:JavaFX Script]]
[[pl:JavaFX Script]]