package org.coffeejolts.jfx.gui; import java.util.Calendar; import java.util.Date; import javax.swing.Timer; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.System; class JfxClock{ public attribute running:Boolean; public attribute hours:Number; public attribute minutes:Number; public attribute seconds:Number; private attribute date:Calendar; private attribute timer:Timer; private operation start(); private operation stop(); } attribute JfxClock.date = Calendar.getInstance(); operation JfxClock.start(){ System.out.println("starting"); timer.start(); } operation JfxClock.stop(){ System.out.println("stopping"); timer.stop(); } trigger on(new JfxClock){ var t = this; timer = new Timer(1000,new ActionListener(){ operation actionPerformed(event:ActionEvent){ t.date.setTime(new Date()); t.hours = t.date.get(Calendar.HOUR); t.minutes = t.date.get(Calendar.MINUTE); t.seconds = t.date.get(Calendar.SECOND); } }); } trigger on JfxClock.running = value{ if(running){ start(); }else{ stop(); } }