In December 4, Sun finally launched the Java-based platform javafx 1.0. This platform is based on its widely used Java programming language and aims to build a large number of network programs that can run on computers and mobile phones. Java has always been a programming language, but with the release of javafx, sun began to allow the task of program content innovation to be transferred to designers focusing on design rather than programming science.
I recently read the javafx API to show you a small example of javafx. As you can see, the interface effect of javafx is much better than that of swing.
First, you need to go to Sun to download the javafx SDK. After installation, the environment variables are automatically configured, and you do not need to do it yourself. Before installing javafx, you must download javase 6.0 update11, which is the latest version of javase.
The following are examples and examples of javafx.
First:
Import javafx. stage. stage; <br/> Import javafx. scene. paint. color; <br/> Import javafx. scene. text. font; <br/> Import javafx. scene. text. text; <br/> Import javafx. scene. scene; </P> <p> stage {<br/> title: "A javafx example" <br/> Scene: Scene {<br/> Fill: color. orange <br/> content: <br/> [<br/> text {<br/> content: "Welcome to the javafx world" <br/> X: 25 Y: 25 <br/> Fill: color. black Font: font {size: 10 }< br/>}</P> <p> text {<br/> content: "This is the second tag" <br/> X: 50 y: 50 <br/> Fill: color. black Font: font {size: 15 }< br/>}< br/>] <br/>}< br/>
Second:
Import javafx. stage. stage; <br/> Import javafx. stage. stagestyle; <br/> Import javafx. scene. scene; <br/> Import javafx. scene. paint. color; <br/> Import javafx. scene. text. text; <br/> Import javafx. scene. text. font; <br/> Import javafx. ext. swing. swingbutton; <br/> Import javax. swing. joptionpane; </P> <p> stage {<br/> title: "application title" <br/> width: 250 <br/> height: 80 <br/> style: stagestyle. transparent <br/> Scene: Scene {<br/> Fill: color. orange <br/> content: <br/> [<br/> swingbutton <br/> {<br/> text: "click... "<br/> action: function (): void {<br/> joptionpane. showmessagedialog (null, "Welcome ~! ") <Br/>}< br/> translatex: 90 translatey: 10 <br/>}</P> <p> swingbutton {<br/> text: "Myself" <br/> action: function (): void {<br/> joptionpane. showmessagedialog (null, "This is my own button! ") <Br/>}< br/> translatex: 150 translatey: 10 <br/>}< br/>] <br/>}< br/> visible: true <br/>}< br/>