JavaFX Script: Difference between revisions

Content deleted Content added
 
(192 intermediate revisions by more than 100 users not shown)
Line 1:
{{More footnotes|date=April 2011}}
'''JavaFX Script''' is a [[scripting language]] designed by [[Sun Microsystems]], working in the [[Java Platform]] and intended to be more productive and easier than [[Java (programming language)|Java]]. It is targeted for the same class of interactive web applications for which [[Adobe Flash]], [[Ajax (programming)|AJAX]] and [[Microsoft Silverlight]] are targeted. It works with major [[integrated development environment|IDE]]s like [[Netbeans|NetBeans]] and Eclipse.
{{Infobox programming language
| name = JavaFX
| logo = JavaFX Logo.png
| logo size = 220px
| developer = [[Sun Microsystems]]
| latest release version = 1.2
| latest release date = {{start date|2009|06|02}}
| latest preview version =
| latest preview date =
| platform = [[Java Runtime Environment]]
| operating_system = [[Cross-platform]]
| license = [[GNU General Public License|GPL]]
| website = http://javafx.com/
}}
 
'''JavaFX Script''' was a [[scripting language]] designed by [[Sun Microsystems]], forming part of the [[JavaFX]] family of technologies on the [[Java Platform]].
== License ==
JavaFX is released under [[GNU]] [[GNU General Public License|General Public License (GPL)]].
 
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]], [[Eclipse (software)|Eclipse]] and [[IntelliJ IDEA]]. JavaFX is released under the [[GNU General Public License]], via the Sun sponsored [[OpenJFX]] project.
== History==
JavaFX Script used to be called '''F3''' for '''F'''orm '''F'''ollows '''F'''unction. F3 was primarily developed by Chris Oliver, who became a [[Sun Microsystems|Sun]] employee through their acquisition of [[SeeBeyond Technology Corporation]] in [[September 2005]].
 
==History==
Its name was changed to JavaFX Script, and it became [[Open source|Open sourced]] on [[JavaOne|JavaOne 2007]].
<!-- Image with unknown copyright status removed: [[File:ig_javafx_architecture.jpg|300px|thumb|JavaFX Script will simplify the development of interactive applications for virtually any device.]] -->
JavaFX Script used to be called '''F3''' for '''F'''orm '''F'''ollows '''F'''unction. F3 was primarily developed by Chris Oliver, who became a [[Sun Microsystems|Sun]] employee through their acquisition of [[SeeBeyond Technology Corporation]] in September 2005.
 
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 with 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 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>
 
== Features ==
JavaFX Script iswas a compiled, [[Type system#Static and dynamic typing|statically typed]], [[Declarative programming language|declarative]] [[scripting language]] for the [[Java Platform]]. It providingprovided automatic data-binding, full support for 2D graphics and standard [[Swingmutation (Java)|Swingtrigger]]s components as well asand [[declarative animation. As it is built on top of the [[Java Platform]], itusing isan easyexpression tolanguage use any [[Javasyntax (programmingall language)|Java]]code classesblocks inpotentially JavaFXyield scriptsvalues.)
 
Through its standard [[JavaFX]] APIs it supported [[retained mode]] vector graphics, video playback and standard [[Swing (Java)|Swing]] components.
JavaFX is able to run on any platform which has the [[Java Virtual Machine|Java Runtime]] installed. No modifications are needed since the JavaFX compiler generates default [[Java bytecode]].
 
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 was able to run on any platform that has a recent [[Java Runtime Environment|Java Runtime]] installed.
JavaFX Script's syntax is more like [[Visual Basic]] - in that components are specified [[Declarative programming language|declaratively]], and [[Callback (computer science)|callbacks]] are linked via a bind operation. This contrasts strongly to Swing, which has a verbose syntax that is confronting to many experienced developers.
 
== ExamplesSyntax ==
JavaFX Script's declarative style for constructing user interfaces can provide shorter and more readable source code than the more verbose series of method calls required to construct an equivalent interface if written in JavaFX Script's procedural style.
Here is a simple [[Hello world program]] for JavaFX Script :
Frame {
title: "Hello World JavaFX"
width: 200
content: Label {
text: "Hello World"
}
visible: true
}
It shows the following panel : [[Image:F3_Hello_World.png|200px]]
 
Here is a simple [[Hello world program]] for JavaFX Script:
This program can also be written in this way :
<syntaxhighlight lang="java">
var win = new Frame();
import javafx.stage.Stage;
win.title = "Hello World JavaFX";
import javafx.scene.Scene;
win.width = 200;
import javafx.scene.text.Text;
var label = new Label();
import javafx.scene.text.Font;
label.text = "Hello World";
win.content = label;
win.visible = true;
 
Stage {
==Related projects==
title: "Hello World"
* [[Groovy (programming language)|Groovy]] http://groovy.codehaus.org/
width: 250
* [[JRuby]] http://jruby.codehaus.org/
height: 80
* [[Jython]] http://www.jython.org/Project/index.html
scene: Scene {
* [[OpenLaszlo]] http://www.openlaszlo.org/
content: Text {
font : Font {
size : 24
}
x: 10, y: 30
content: "Hello World"
}
}
}
</syntaxhighlight>
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.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
 
var myFont: Font = Font.font(null, 24);
 
var myText: Text = new Text();
myText.font = myFont;
myText.x = 10;
myText.y = 30;
myText.content = "Hello World";
 
var myScene:Scene = new Scene();
myScene.content = myText;
 
var myStage: Stage = new Stage();
myStage.title = "Hello World";
myStage.width = 250;
myStage.height = 80;
myStage.scene = myScene;
</syntaxhighlight>
 
== See also ==
{{Portal|Computer 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)]].
* [[Swing (Java)|Swing]], the underlying user interface library employed by JavaFX Script.
* [[Curl (programming language)]], also with a declarative mode with optional typing
 
== References ==
<references/>
 
==Bibliography==
{{refbegin}}
* {{citation
| first1 = Simon
| last1 = Morris
| date = November 23, 2009
| title = JavaFX in Action
| publisher = [[Manning Publications|Manning]]
| pages = 375
| isbn = 978-1-933988-99-3
| 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-0
|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-3
|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-9
|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-1
|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-7
| 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.nytimes.com/2007/05/08/technology/08sun.html Sun Plans Version of Java for Web-Linked Cellphones] ([[New York Times]] article)
* [http://www.sun.com/software/javafx/index.jsp Sun's JavaFX overview]
* [http://news.com.com/Sun+tries+again+with+consumer-flavored+Java/2100-1007_3-6181922.html Sun tries again with consumer-flavored Java] ([[CNET]] article)
* [http://blogs.oracle.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://www.sun.com/software/javafx/index.jsp JavaFX Website]
* [http://learnjavafx.typepad.com James Weaver's Learn JavaFX Weblog]
* [https://openjfx.dev.java.net/ JavaFX Development Website]
* [http://java.sun.com/developer/technicalArticles/scripting/javafxpart1/ Sun.com - Learning JavaFX Script: An Introduction for Java Programmers]
* [http://blogs.sun.com/chrisoliver/category/F3 Chris Oliver's blog, F3 category]
* [https://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:JavaFX Script}}
{{compu-stub}}
[[Category:Scripting languages]]
[[Category:Declarative programming languages]]
[[Category:Java programming language family]]
[[Category:JVM programming languages]]
[[Category:Scripting languages]]