JavaFX Script: Difference between revisions

Content deleted Content added
m External links: archive link repair, may include: archive.* -> archive.today, and http->https for ghostarchive.org and archive.org (wp:el#Specifying_protocols)
 
(19 intermediate revisions by 15 users not shown)
Line 2:
{{Infobox programming language
| name = JavaFX
| logo = [[File:JavaFX Logo.png|200px]]
| logo size = 220px
| 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''' 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]], [[Eclipse (software)|Eclipse]] and [[IntelliJ IDEA]]. JavaFX is released under the [[GNU General Public License]], via the Sun sponsored [https://web.archive.org/web/20070610234324/https://openjfx.dev.java.net/ [OpenJFX]] project].
 
==History==
<!-- 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 (software engineer)|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 released]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 [https://github.com/visage-lang 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>
More recently, the original [https://github.com/unktomi/form-follows-function/ F3 programming language] is now in the process of being resurrected and enhanced.
 
== Features ==
Line 34 ⟶ 36:
Through its standard [[JavaFX]] APIs it supported [[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 was able to run on any platform that 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 {
title: "Hello World"
width: 250
height: 80
scene: Scene {
content: Text {
font : Font {
size : 24
}
x: 10, y: 30
content: "Hello World"
}
}
}
</syntaxhighlight>
It shows the following window/frame :
Line 65 ⟶ 67:
[[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;
var myFrame:SwingFrame = new SwingFrame();
import javafx.scene.text.Font;
var myLabel:Label = new Label();
 
var myFont: Font = Font.font(null, 24);
myLabel.text = "Hello World!";
 
myFrame.width = 200;
var myLabelmyText:Label Text = new LabelText();
myFrame.height = 50;
myText.font = myFont;
myFrame.visible = true;
myText.x = 10;
myFrame.content = myLabel;
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>
 
Line 102 ⟶ 115:
}}
* {{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.sun.com/software/javafx/index.jsp Sun's JavaFX overview]
* [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://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]