1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
/* * Class : DateTrack.fx * * Created on Nov 20, 2009, 3:35:25 PM * ============================================================= This program will update the date of your current System Date Now we are tracking date via help of UTILITY CLASS "DATE" and we are taking advantage of the Timeline and init() If any thing goes wrong then please comment me ============================================================== */ package practice; // you can change as per your package //Import Directives... import java.util.Date; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.animation.Timeline; import javafx.animation.KeyFrame; /** * @author NARAYAN */ //-------------------- //Variable declaration //-------------------- var myDate = ""; // just initializing.. //This will execute init() of Clock Class var myClock = new Clock(); //Declaring Class Clock for updating Date class Clock { public function nextTime() { var now = new Date(); myDate = "{%tEc now}"; /* * {%tEc now} is the extended format used * for the java.util.Date object ("now"). * * %tx - Localized date * %tX - Localized time * %tu - A day of the week (1-7, 1 is for Monday) * %tEx - Locale's alternate date representation * %tEX - Locale's alternate time representation * */ } // THIS WILL BE EXECUTED AT FIRST... init { //INITIAL var time = Timeline { repeatCount: Timeline.INDEFINITE keyFrames: [ KeyFrame { time: 1s action: function() { nextTime(); } } ] } time.play(); // TAKING ACTION TO PLAY } } Stage { title: "Application title" width: 250 height: 80 scene: Scene { content: [ Text { font : Font { size : 16 } x: 10 y: 30 // Binding the current date // which helps to show updated date content: bind {myDate}; } ] } } |
Hi, I need bind a text into .fxz file (this is the adobe illustrator convertion of an .ai file)
Do you know how I can do this?
Thx
Hi Eros,
In Javafx 1.3 the bind works for most of all things . Even in FXZ also the graphics are converted to JavaFX Script and then we can add bind later on using ‘bind” It depends on how your fxz structure is .
Thanks.