Rethinking the JavaFX stage 0
The author looks at enhancing the JavaFX ‘Stage’ object by creating global keyboard functions and adding a visual disable feature.
The author looks at enhancing the JavaFX ‘Stage’ object by creating global keyboard functions and adding a visual disable feature.
Finally, today i decide to enter this month jfxstudio challenge, here is my submission:

Muslims are supposed to perform five prayers every day. Each prayer is given a certain prescribed time in which it must be performed. this application show current time & five prayer time for muslim specific for my current city (Bandung, latitude:6.54 & longitude: 107.36), with polar clock as visualization.
to compute prayer time, i use formula that described in this site http://tanzil.info/praytime/doc/calculation/.
source code:
number of characters: 2987 (without white spaces/characters
)
number of lines: 195
you can find more readable code at my blog
var h;
var m;
var s;
var date;
var day;
var month;
var year;
var cal;
var tm = Timeline{
repeatCount:Timeline.INDEFINITE
keyFrames:[
KeyFrame{
time:100ms
action:function(){
cal = cc();
s = (cal.get(Calendar.SECOND) + (cal.get(Calendar.MILLISECOND) as Float)/1000)/60;
m = (cal.get(Calendar.MINUTE) + s)/60;
h = (cal.get(Calendar.HOUR) + m)/12
}
}]
}
var sdf = new SimpleDateFormat("yyyy-MM-dd");
var to = sdf.format(Calendar.getInstance().getTime());
function cc(){
var date = new Date();
def c = Calendar.getInstance();
c.setTime(new Date());c
}
def p = Math.PI;
class PC extends CustomNode{
var cX = 10;
var cY = 10;
var sw = 11;
var r = 50;
var sl = 250;
var ml = 90;
var hl = 30;
var t = "";
override function create(){
Group{
opacity:0.85
content:[
Arc {
centerX:cX, centerY:cY
radiusX:r, radiusY:r
startAngle:90 length:bind -sl + sw*360.0/(4*p*r)
stroke:Color.GREEN
fill:null
strokeWidth:sw
}
Arc {
centerX:cX centerY:cY
radiusX:r-17 radiusY:r-17
startAngle:90 length:bind -ml + sw*360.0/(4*p*r)
stroke:Color.RED
fill:null
strokeWidth:sw
}
Arc {
centerX:cX centerY:cY
radiusX:r-34 radiusY:r-34
startAngle:90 length:bind -hl + sw*360.0/(4*p*r)
stroke:Color.BLUE
fill:null
strokeWidth:sw
}
Label {
translateY:cY + r + 10
translateX:cX-r/2;
text:t
textFill:Color.GOLD
}
]
}
}
}
def JD = 2440588;
def d2r = p/180;
def r2d = 57.2957795;
var dt = DateTime{};
var jd = JD + Math.floor(dt.instant/(1000*60*60*24));
var D = jd-2451545.0;
var g = 357.529 + 0.98560028*D;
var q = 280.459 + 0.98564736* D;
var L = q + 1.915* sn(g) + 0.020*sn(2*g);
var R = 1.00014 - 0.01671*cs(g) - 1.4e-4*cs(2*g);
var e = 23.439 - 3.6e-7* D;
var RA = atn2(cs(e)*sn(L),cs(L))/15;
var d = asn(sn(e)*sn(L));
var EqT = q/15 - RA;
def TZ = 7;
def lat = 6.54;
def lng = 107.36;
var dz = fx(12 + TZ - lng/15 - EqT);
var dh = [th(Math.floor(dz)),t6((dz - Math.floor(dz))*60)];
var f = dz - T(18);
var fh = [th(Math.floor(f)),t6((f - Math.floor(f))*60)];
var i = dz + T(17);
var ih = [th(Math.floor(i)),t6((i - Math.floor(i))*60)];
var a = dz + 1.0/15*acs((sn(actn(1.0 + tn(lat-d)))-(sn(lat)*sn(d)))/(cs(lat)*cs(d)));
var ah = [th(Math.floor(a)),t6((a - Math.floor(a))*60)];
var mg = dz + T(0.8333);
var mh = [th(Math.floor(mg)),t6((mg - Math.floor(mg))*60)];
function T(a) { 1.0/15*acs(-sn(a*1.0)-sn(lat)*sn(d)/cs(lat)*cs(d)) }
function fx(a:Float){
var b = a - 24.0 * Math.floor(a / 24.0);
if (b < 0) b = b + 24.0;
b
}
function th (h:Integer) { if (h>12) h-12 else h }
function t6(m:Integer) { if(m>60) m-60 else m }
function sn (a) { Math.sin(a*d2r)}
function cs (a) { Math.cos(a*d2r)}
function tn (a) { Math.tan(a*d2r)}
function actn (a){ Math.atan(1.0/a)*r2d }
function acs(a) { Math.acos(a*1.0)*r2d}
function asn(a) { Math.asin(a*1.0)*r2d}
function atn(a) { Math.atan(a*1.0)*r2d}
function atn2 (y,x) { Math.atan2(y*1.0, x*1.0)*r2d }
public function run () {
tm.play();
var scene = Scene {
width: 500
height: 500
fill: Color.BLACK
content: [
ImageView {
image: Image {
url: "http://iwidget.googlecode.com/files/m.png"
}
}
PC{
r:120
cX: 150
cY: 160
sw:15
sl:bind 360*s
ml: bind 360*m
hl:bind 360*h
t: to
}
PC{
cX: 340
cY: 60
ml: fh[1]*6
hl: fh[0]*30
t: "Fajr: {fh[0]}:{fh[1]} am"
}
PC{
cX: 340
cY: 200
ml: dh[1]*6
hl: dh[0]*30
t: "Dzuhr: {dh[0]}:{dh[1]} am"
}
PC{
r:70
cX: 340
cY: 360
ml: ah[1]*6
hl: ah[0]*30
t: "Ashr: {ah[0]}:{ah[1]} pm"
}
PC{
cX: 190
cY: 400
ml: mh[1]*6
hl: mh[0]*30
t: "Maghrib: {mh[0]}:{mh[1]} pm"
}
PC{
cX: 70
cY: 400
ml: ih[1]*6
hl: ih[0]*30
t: "Isya: {ih[0]}:{ih[1]} pm"
}]
}
def stage = Stage {scene: scene}stage.visible = true;
}
Finally, today i decide to enter this month jfxstudio challenge, here is my submission:

Muslims are supposed to perform five prayers every day. Each prayer is given a certain prescribed time in which it must be performed. this application show current time & five prayer time for muslim specific for my current city (Bandung, latitude:6.54 & longitude: 107.36), with polar clock as visualization.
to compute prayer time, i use formula that described in this site http://tanzil.info/praytime/doc/calculation/.
source code:
number of characters: 2987 (without white spaces/characters
)
number of lines: 195
you can find more readable code at my blog
var h;
var m;
var s;
var date;
var day;
var month;
var year;
var cal;
var tm = Timeline{
repeatCount:Timeline.INDEFINITE
keyFrames:[
KeyFrame{
time:100ms
action:function(){
cal = cc();
s = (cal.get(Calendar.SECOND) + (cal.get(Calendar.MILLISECOND) as Float)/1000)/60;
m = (cal.get(Calendar.MINUTE) + s)/60;
h = (cal.get(Calendar.HOUR) + m)/12
}
}]
}
var sdf = new SimpleDateFormat("yyyy-MM-dd");
var to = sdf.format(Calendar.getInstance().getTime());
function cc(){
var date = new Date();
def c = Calendar.getInstance();
c.setTime(new Date());c
}
def p = Math.PI;
class PC extends CustomNode{
var cX = 10;
var cY = 10;
var sw = 11;
var r = 50;
var sl = 250;
var ml = 90;
var hl = 30;
var t = "";
override function create(){
Group{
opacity:0.85
content:[
Arc {
centerX:cX, centerY:cY
radiusX:r, radiusY:r
startAngle:90 length:bind -sl + sw*360.0/(4*p*r)
stroke:Color.GREEN
fill:null
strokeWidth:sw
}
Arc {
centerX:cX centerY:cY
radiusX:r-17 radiusY:r-17
startAngle:90 length:bind -ml + sw*360.0/(4*p*r)
stroke:Color.RED
fill:null
strokeWidth:sw
}
Arc {
centerX:cX centerY:cY
radiusX:r-34 radiusY:r-34
startAngle:90 length:bind -hl + sw*360.0/(4*p*r)
stroke:Color.BLUE
fill:null
strokeWidth:sw
}
Label {
translateY:cY + r + 10
translateX:cX-r/2;
text:t
textFill:Color.GOLD
}
]
}
}
}
def JD = 2440588;
def d2r = p/180;
def r2d = 57.2957795;
var dt = DateTime{};
var jd = JD + Math.floor(dt.instant/(1000*60*60*24));
var D = jd-2451545.0;
var g = 357.529 + 0.98560028*D;
var q = 280.459 + 0.98564736* D;
var L = q + 1.915* sn(g) + 0.020*sn(2*g);
var R = 1.00014 - 0.01671*cs(g) - 1.4e-4*cs(2*g);
var e = 23.439 - 3.6e-7* D;
var RA = atn2(cs(e)*sn(L),cs(L))/15;
var d = asn(sn(e)*sn(L));
var EqT = q/15 - RA;
def TZ = 7;
def lat = 6.54;
def lng = 107.36;
var dz = fx(12 + TZ - lng/15 - EqT);
var dh = [th(Math.floor(dz)),t6((dz - Math.floor(dz))*60)];
var f = dz - T(18);
var fh = [th(Math.floor(f)),t6((f - Math.floor(f))*60)];
var i = dz + T(17);
var ih = [th(Math.floor(i)),t6((i - Math.floor(i))*60)];
var a = dz + 1.0/15*acs((sn(actn(1.0 + tn(lat-d)))-(sn(lat)*sn(d)))/(cs(lat)*cs(d)));
var ah = [th(Math.floor(a)),t6((a - Math.floor(a))*60)];
var mg = dz + T(0.8333);
var mh = [th(Math.floor(mg)),t6((mg - Math.floor(mg))*60)];
function T(a) { 1.0/15*acs(-sn(a*1.0)-sn(lat)*sn(d)/cs(lat)*cs(d)) }
function fx(a:Float){
var b = a - 24.0 * Math.floor(a / 24.0);
if (b < 0) b = b + 24.0;
b
}
function th (h:Integer) { if (h>12) h-12 else h }
function t6(m:Integer) { if(m>60) m-60 else m }
function sn (a) { Math.sin(a*d2r)}
function cs (a) { Math.cos(a*d2r)}
function tn (a) { Math.tan(a*d2r)}
function actn (a){ Math.atan(1.0/a)*r2d }
function acs(a) { Math.acos(a*1.0)*r2d}
function asn(a) { Math.asin(a*1.0)*r2d}
function atn(a) { Math.atan(a*1.0)*r2d}
function atn2 (y,x) { Math.atan2(y*1.0, x*1.0)*r2d }
public function run () {
tm.play();
var scene = Scene {
width: 500
height: 500
fill: Color.BLACK
content: [
ImageView {
image: Image {
url: "http://iwidget.googlecode.com/files/m.png"
}
}
PC{
r:120
cX: 150
cY: 160
sw:15
sl:bind 360*s
ml: bind 360*m
hl:bind 360*h
t: to
}
PC{
cX: 340
cY: 60
ml: fh[1]*6
hl: fh[0]*30
t: "Fajr: {fh[0]}:{fh[1]} am"
}
PC{
cX: 340
cY: 200
ml: dh[1]*6
hl: dh[0]*30
t: "Dzuhr: {dh[0]}:{dh[1]} am"
}
PC{
r:70
cX: 340
cY: 360
ml: ah[1]*6
hl: ah[0]*30
t: "Ashr: {ah[0]}:{ah[1]} pm"
}
PC{
cX: 190
cY: 400
ml: mh[1]*6
hl: mh[0]*30
t: "Maghrib: {mh[0]}:{mh[1]} pm"
}
PC{
cX: 70
cY: 400
ml: ih[1]*6
hl: ih[0]*30
t: "Isya: {ih[0]}:{ih[1]} pm"
}]
}
def stage = Stage {scene: scene}stage.visible = true;
}
Google’s new music search feature may be great if you already know what you’re looking for, but it doesn’t foster the discovery applications like Music Explorer FX does. Check out the latest JavaFX updates in the JavaFX Coding Challenge winning application, Music Explorer FX.
This is an announcement of the new Silicon Valley JavaFX Users Group. The first meeting will be on December 9th with Rockstar speaker Richard Bair, so if you are in the bay area or want to watch the live stream, be sure to sign up!
There’s a rock star wannabe within all of us. We’ve all rocked out to our favorite tunes. But only a small minority of us can actually get up and create good music. If you’re in the majority, like myself, then your rock star dream is going to come true at a minor, but significant level. Say hello to Soundation . Soundation is a free web service that lets you mix up awesome beats and create truly original music. First important thing to mention is: all you need is an internet browser and
Go to Source
JavaFX Studio works as an Eclipse plugin for developing and deploying JavaFX applications. JavaFX Studio comes with numerous features and wizards to make JavaFX application development better.
A while back, in the previous part of this bluffer’s guide, we looked at JavaFX Script’s declarative syntax, and support for sophisticated binding of code to data. In this part we’re focusing entirely on strings.
Not the most exciting of topics, you might perhaps be thinking? Well, perhaps you’ll change your mind by the time you reach the conclusion.
JavaFX shouldn’t mean the end of Swing. Senior developer Sten Anderson explains how there’s plenty of room for both Swing and JavaFX in the client-side Java ecosphere.
The deadline for this month’s challenge is almost here: Saturday, spooky October 31st. However, if you are still coding until the last minute you’ll get a few extra hours.
This Saturday I’m flying to Sweden for the OreDev conference. It’s quite a fun event that I greatly enjoyed last year. I get a chance to interact with lots of people and learn about technologies outside my usual sphere (things like Silverlight and Ruby). If you live in Europe I highly recommend attending.
Since I’ll be somewhere over Greenland at midnight I’m going to give everyone until I reach my hotel room in Malmo, which is roughly Sunday evening.
Have fun coding. I can’t wait to see what you cook up this month.
Oh, one more thing. Here’s an interview with Mark Nankman, last month’s winner.