/* * Main.fx * * Created on 2008/12/12, 1:53:17 */ package javafxapplication2; import java.lang.*; import javaapplication1.Customer; import javaapplication1.CustomerLoadImpl; import javafx.animation.Interpolator; import javafx.animation.Timeline; import javafx.async.AbstractAsyncOperation; import javafx.ext.swing.SwingButton; import javafx.ext.swing.SwingTextField; import javafx.scene.effect.light.DistantLight; import javafx.scene.effect.Lighting; import javafx.scene.Group; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.scene.Scene; import javafx.scene.shape.ArcTo; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.stage.Stage; /** * @author tkenji */ var tmpid = "1"; var CustomerId = 1; var CustomerName = ""; public class CustomerLoad extends AbstractAsyncOperation { var peer: CustomerLoadImpl; public-init var customer:Customer; public var onComplete: function(customer: Customer): Void; public override function cancel() : Void { if (peer != null) then peer.cancel(); } protected override function start() : Void { peer = new CustomerLoadImpl(customer, CustomerId, listener); peer.start(); } protected override function onCompletion(value : Object) : Void { this.customer = peer.getCustomer(); onComplete(customer); } } var x: Number; var y: Number; function run() { Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true keyFrames: [ at (0s) {x => 0.0}, at (7s) {x => 387.0 tween Interpolator.LINEAR}, ] }.play(); Timeline { repeatCount: Timeline.INDEFINITE autoReverse: true keyFrames: [ at (0s) {y => 0.0}, at (4s) {y => 55.0 tween Interpolator.LINEAR}, ] }.play(); Stage { title: "Application title" width: 600 height: 400 scene: Scene { content: [ Group { content: VBox { content: [ Group { content: HBox { content: [ SwingTextField { columns: 10 text: bind tmpid with inverse editable: true }, SwingButton { text: "OK" onMouseClicked: function( e: MouseEvent ):Void { CustomerId = Integer.parseInt(tmpid); // CustomerName = CustomerDB.findCustomer(CustomerId).getName(); var tmpcustomer = new Customer(); var test = CustomerLoad { customer: tmpcustomer onComplete: function(cus: Customer) : Void { if (cus != null) { CustomerName = cus.getName(); } } } } } ] } }, Text { font: Font { size: 18 } x:10, y:50 content: bind CustomerName }, ImageView{ translateY: 100 image: Image{ url: "http://java.sun.com/docs/books/tutorial/2d/basic2d/examples/images/weather-sun.png" } }, Path { translateX: bind x translateY: bind y fill: Color.WHITE stroke: Color.LIGHTBLUE strokeWidth: 2 effect: Lighting{ light: DistantLight{ azimuth: 90 } } elements: [ MoveTo { x: 15 y: 15 }, ArcTo { x: 50 y: 10 radiusX: 20 radiusY: 20 sweepFlag: true}, ArcTo { x: 70 y: 20 radiusX: 20 radiusY: 20 sweepFlag: true}, ArcTo { x: 50 y: 60 radiusX: 20 radiusY: 20 sweepFlag: true}, ArcTo { x: 20 y: 50 radiusX: 10 radiusY: 5 sweepFlag: true}, ArcTo { x: 15 y: 15 radiusX: 10 radiusY: 10 sweepFlag: true}, ] }//Path ] } } ] } } }