
Before you begin, you need to install the following software on your
computer.





















| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; /** * @author sang */ // place your code here Frame { title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true stage: Stage { content: [Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: "HelloWorld" }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK effect: Lighting { light: DistantLight { azimuth: 60 } } }] } } |



| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; import javafx.input.MouseEvent; /** * @author sang */ // place your code here Frame { title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true var counter:Integer = 0 stage: Stage { content: [ Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: "HelloWorld" }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK effect: Lighting { light: DistantLight { azimuth: 60 } } onMousePressed: function( e: MouseEvent ):Void { if (counter mod 2 == 0) { e.node.effect = null } else { e.node.effect = Lighting { light: DistantLight { azimuth: 60 } } } counter++ } }] } } |


| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; import javafx.input.MouseEvent; /** * @author sang */ // place your code here Frame { var message:String = "Good morning!" title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true var counter:Integer = 0 stage: Stage { content: [ Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: bind message }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK effect: Lighting { light: DistantLight { azimuth: 60 } } onMousePressed: function( e: MouseEvent ):Void { if (counter mod 2 == 0) { e.node.effect = null } else { e.node.effect = Lighting { light: DistantLight { azimuth: 60 } } } counter++ } }] } } |
| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; import javafx.input.MouseEvent; /** * @author sang */ // place your code here Frame { var message:String = "Good morning!" title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true var counter:Integer = 0 stage: Stage { content: [ Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: bind message }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK effect: Lighting { light: DistantLight { azimuth: 60 } } onMousePressed: function( e: MouseEvent ):Void { if (counter mod 2 == 0) { e.node.effect = null; message ="Coffee" } else { e.node.effect = Lighting { light: DistantLight { azimuth: 60 } } message = "Tea" } counter++ } }] } } |
| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; import javafx.input.MouseEvent; /** * @author sang */ // Create a model class public class HelloWorldModel{ public attribute message:String; public attribute color:Color; } // place your code here Frame { var message_model = HelloWorldModel{ message: "Sang" color: Color.AQUA } title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true var counter:Integer = 0 stage: Stage { content: [ Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: bind message_model.message fill: bind message_model.color }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK effect: Lighting { light: DistantLight { azimuth: 60 } } onMousePressed: function( e: MouseEvent ):Void { if ( counter mod 2 == 0) { e.node.effect = null; message_model.message ="Banana"; message_model.color = Color.YELLOW; } else { e.node.effect = Lighting { light: DistantLight { azimuth: 60 } } message_model.message ="Apple"; message_model.color = Color.RED; } counter++ } }] } } |


| package javafxhelloworld; import javafx.application.Frame; import javafx.application.Stage; import javafx.scene.text.Text; import javafx.scene.Font; import javafx.scene.FontStyle; import javafx.scene.paint.Color; import javafx.scene.geometry.Circle; import javafx.scene.effect.Lighting; import javafx.scene.effect.light.DistantLight; import javafx.input.MouseEvent; /** * @author sang */ // Create a model class for messages public class HelloWorldModel{ public attribute message:String; public attribute color:Color; } // Create a model class for effects public class HelloWorldEffectModel{ public attribute my_lighting:Lighting; } // place your code here Frame { var message_model = HelloWorldModel{ message: "SangShin" color: Color.AQUA } var lighting1 = Lighting { light: DistantLight { azimuth: 60 } } var lighting2 = Lighting { light: DistantLight { azimuth: 240 } } var effect_model = HelloWorldEffectModel{ my_lighting: lighting1 } title: "HelloWorldJavaFX" width: 400 height: 100 closeAction: function() { java.lang.System.exit( 0 ); } visible: true var counter:Integer = 0 stage: Stage { content: [ Text { font: Font { size: 24 style: FontStyle.PLAIN } x: 10, y: 30 content: bind message_model.message fill: bind message_model.color }, Circle { centerX: 200, centerY: 30 radius: 30 fill: Color.PINK //effect: Lighting { // light: DistantLight { // azimuth: 60 // } //} effect: bind effect_model.my_lighting onMousePressed: function( e: MouseEvent ):Void { if (counter mod 2 == 0) { //e.node.effect = null; effect_model.my_lighting = lighting2; message_model.message ="Banana"; message_model.color = Color.YELLOW; } else { //e.node.effect = Lighting { // light: DistantLight { // azimuth: 60 // } //} effect_model.my_lighting = lighting1; message_model.message ="Apple"; message_model.color = Color.RED; } counter++ } }] } } |


