<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Bits, Bytes &amp; Words</title>
	<atom:link href="http://www.asgteach.com/blog/?feed=comments-rss2" rel="self" type="application/rss+xml" />
	<link>http://www.asgteach.com/blog</link>
	<description>Just a simple matter of programming</description>
	<lastBuildDate>Sun, 25 Mar 2012 20:45:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>Comment on JavaFX Animation and Binding: Using the ProgressBar by Mike</title>
		<link>http://www.asgteach.com/blog/?p=219#comment-53</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sun, 25 Mar 2012 20:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=219#comment-53</guid>
		<description>Here is the FXML version (I also just tried converting your sketchpad app with a bit more bells and whistles in the FXML and it works fairly well). One thing to note is that there doesn&#039;t seem to be a way to get a hold of the scene variable to base your components&#039; sizes off of it. So instead I just hardcoded it either into the VBox or made a javascript with variables set to those values and then referenced those in the components (let me know if there is a better way to do this).

Timer.java:
[sourcecode language=&quot;java&quot;]
package timer;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Timer extends Application
{
   public static void main(String[] args)
   {
      Application.launch(args);
   }

   @Override
   public void start(Stage primaryStage) throws Exception
   {
      primaryStage.setTitle(&quot;FX Timer Binding/ProgressBar&quot;);

      Group root = FXMLLoader.load(getClass().getResource(&quot;Timer.fxml&quot;));

      Scene scene = new Scene(root);
      primaryStage.setScene(scene);
      primaryStage.show();
   }
}
[/sourcecode]

Timer.fxml:
[sourcecode language=&quot;xml&quot;]
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;?import javafx.scene.Group?&gt;
&lt;?import javafx.scene.layout.VBox?&gt;
&lt;?import javafx.scene.control.Button?&gt;
&lt;?import javafx.scene.control.Label?&gt;
&lt;?import javafx.scene.control.ProgressBar?&gt;
&lt;?import javafx.scene.paint.Color?&gt;
&lt;?import javafx.geometry.Pos?&gt;

&lt;Group xmlns:fx=&quot;http://javafx.com/fxml&quot; fx:controller=&quot;timer.TimerController&quot; &gt;
	&lt;children&gt;
		&lt;VBox spacing=&quot;20&quot; alignment=&quot;CENTER&quot; prefWidth=&quot;300&quot; prefHeight=&quot;250&quot;&gt;
			&lt;children&gt;
				&lt;Button fx:id=&quot;buttonStart&quot; text=&quot;Start Timer&quot; onAction=&quot;#handleStartAction&quot; /&gt;
				&lt;Label fx:id=&quot;timerLabel&quot; text=&quot;15&quot; textFill=&quot;RED&quot; style=&quot;-fx-font-size: 4em;&quot;/&gt;
				&lt;ProgressBar fx:id=&quot;progressBar&quot;/&gt;
			&lt;/children&gt;
		&lt;/VBox&gt;
	&lt;/children&gt;
&lt;/Group&gt;
[/sourcecode]

TimerController.java
[sourcecode language=&quot;java&quot;]
package timer;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.util.Duration;

public class TimerController implements Initializable
{
   private static final Integer STARTTIME   = 15;

   private IntegerProperty      timeSeconds = new SimpleIntegerProperty(STARTTIME * 100);

   private Timeline             timeline;
   
   @FXML
   private Button               buttonStart;

   @FXML
   private Label                timerLabel;

   @FXML
   private ProgressBar          progressBar;

   @Override
   public void initialize(URL location, ResourceBundle resources)
   {
      timerLabel.textProperty().bind(timeSeconds.divide(100).asString());
      progressBar.progressProperty().bind(timeSeconds.divide(STARTTIME * 100.0).subtract(1).multiply(-1));
   }

   @FXML
   protected void handleStartAction(ActionEvent event)
   {
      if (timeline != null)
      {
         timeline.stop();
      }
      timeSeconds.set((STARTTIME + 1) * 100);
      timeline = new Timeline();
      timeline.getKeyFrames().add(

      new KeyFrame(Duration.seconds(STARTTIME + 1), new KeyValue(timeSeconds, 0)));
      timeline.playFromStart();
   }
}

[/sourcecode]</description>
		<content:encoded><![CDATA[<p>Here is the FXML version (I also just tried converting your sketchpad app with a bit more bells and whistles in the FXML and it works fairly well). One thing to note is that there doesn&#8217;t seem to be a way to get a hold of the scene variable to base your components&#8217; sizes off of it. So instead I just hardcoded it either into the VBox or made a javascript with variables set to those values and then referenced those in the components (let me know if there is a better way to do this).</p>
<p>Timer.java:</p>
<pre class="brush: java; title: ;">
package timer;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class Timer extends Application
{
   public static void main(String[] args)
   {
      Application.launch(args);
   }

   @Override
   public void start(Stage primaryStage) throws Exception
   {
      primaryStage.setTitle(&quot;FX Timer Binding/ProgressBar&quot;);

      Group root = FXMLLoader.load(getClass().getResource(&quot;Timer.fxml&quot;));

      Scene scene = new Scene(root);
      primaryStage.setScene(scene);
      primaryStage.show();
   }
}
</pre>
<p>Timer.fxml:</p>
<pre class="brush: xml; title: ;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;

&lt;?import javafx.scene.Group?&gt;
&lt;?import javafx.scene.layout.VBox?&gt;
&lt;?import javafx.scene.control.Button?&gt;
&lt;?import javafx.scene.control.Label?&gt;
&lt;?import javafx.scene.control.ProgressBar?&gt;
&lt;?import javafx.scene.paint.Color?&gt;
&lt;?import javafx.geometry.Pos?&gt;

&lt;Group xmlns:fx=&quot;<a href="http://javafx.com/fxml&#038;quot" rel="nofollow">http://javafx.com/fxml&#038;quot</a>; fx:controller=&quot;timer.TimerController&quot; &gt;
	&lt;children&gt;
		&lt;VBox spacing=&quot;20&quot; alignment=&quot;CENTER&quot; prefWidth=&quot;300&quot; prefHeight=&quot;250&quot;&gt;
			&lt;children&gt;
				&lt;Button fx:id=&quot;buttonStart&quot; text=&quot;Start Timer&quot; onAction=&quot;#handleStartAction&quot; /&gt;
				&lt;Label fx:id=&quot;timerLabel&quot; text=&quot;15&quot; textFill=&quot;RED&quot; style=&quot;-fx-font-size: 4em;&quot;/&gt;
				&lt;ProgressBar fx:id=&quot;progressBar&quot;/&gt;
			&lt;/children&gt;
		&lt;/VBox&gt;
	&lt;/children&gt;
&lt;/Group&gt;
</pre>
<p>TimerController.java</p>
<pre class="brush: java; title: ;">
package timer;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.util.Duration;

public class TimerController implements Initializable
{
   private static final Integer STARTTIME   = 15;

   private IntegerProperty      timeSeconds = new SimpleIntegerProperty(STARTTIME * 100);

   private Timeline             timeline;

   @FXML
   private Button               buttonStart;

   @FXML
   private Label                timerLabel;

   @FXML
   private ProgressBar          progressBar;

   @Override
   public void initialize(URL location, ResourceBundle resources)
   {
      timerLabel.textProperty().bind(timeSeconds.divide(100).asString());
      progressBar.progressProperty().bind(timeSeconds.divide(STARTTIME * 100.0).subtract(1).multiply(-1));
   }

   @FXML
   protected void handleStartAction(ActionEvent event)
   {
      if (timeline != null)
      {
         timeline.stop();
      }
      timeSeconds.set((STARTTIME + 1) * 100);
      timeline = new Timeline();
      timeline.getKeyFrames().add(

      new KeyFrame(Duration.seconds(STARTTIME + 1), new KeyValue(timeSeconds, 0)));
      timeline.playFromStart();
   }
}
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX Animation and Binding: Using the ProgressBar by Gail</title>
		<link>http://www.asgteach.com/blog/?p=219#comment-52</link>
		<dc:creator>Gail</dc:creator>
		<pubDate>Sun, 25 Mar 2012 18:07:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=219#comment-52</guid>
		<description>Hi Mike,

Thanks for taking the time to leave a comment! I appreciate the feedback.

After I quick search I found the following set of tutorials which explores building a JavaFX enterprise application here: &lt;a href=&quot;http://www.zenjava.com/series/building-jee-applications-in-javafx-2-0/&quot; rel=&quot;nofollow&quot;&gt;http://www.zenjava.com/series/building-jee-applications-in-javafx-2-0/&lt;/a&gt;. The material looks very helpful.

Yes, I agree using FXML helps separate the view and lets you build an MVC-structured app. Also, the FXML lets you see the hierarchical arrangement of your scenegraph--which helps with maintenance. Here is a link for readers who would like to explore FXML further: &lt;a href=&quot;http://docs.oracle.com/javafx/2.0/fxml_get_started/why_use_fxml.htm&quot; rel=&quot;nofollow&quot;&gt;http://docs.oracle.com/javafx/2.0/fxml_get_started/why_use_fxml.htm&lt;/a&gt;.

As you noted, I was focusing on the JavaFX API in this post. By all means, I encourage you to post the FXML for this Timer example. I think readers would like to see the implementation differences.

Again, thanks for the feedback.</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Thanks for taking the time to leave a comment! I appreciate the feedback.</p>
<p>After I quick search I found the following set of tutorials which explores building a JavaFX enterprise application here: <a href="http://www.zenjava.com/series/building-jee-applications-in-javafx-2-0/" rel="nofollow">http://www.zenjava.com/series/building-jee-applications-in-javafx-2-0/</a>. The material looks very helpful.</p>
<p>Yes, I agree using FXML helps separate the view and lets you build an MVC-structured app. Also, the FXML lets you see the hierarchical arrangement of your scenegraph&#8211;which helps with maintenance. Here is a link for readers who would like to explore FXML further: <a href="http://docs.oracle.com/javafx/2.0/fxml_get_started/why_use_fxml.htm" rel="nofollow">http://docs.oracle.com/javafx/2.0/fxml_get_started/why_use_fxml.htm</a>.</p>
<p>As you noted, I was focusing on the JavaFX API in this post. By all means, I encourage you to post the FXML for this Timer example. I think readers would like to see the implementation differences.</p>
<p>Again, thanks for the feedback.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX Animation and Binding: Using the ProgressBar by Mike</title>
		<link>http://www.asgteach.com/blog/?p=219#comment-51</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sun, 25 Mar 2012 16:44:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=219#comment-51</guid>
		<description>A couple of thoughts:

First, thank you very much for this blog post/tutorial. Your writing is concise and your focus on one &quot;feature&quot; makes it much easier to comprehend and build skills with JavaFX.

Second, I have been using GWT for about a year and despite its ability to make stunning web apps, I have found myself fighting against the framework to get relatively simple things done (especially the new RequestFactory and Editor frameworks). JavaFX looks like a nice alternative (except that it runs as a plugin instead of a website which is both a hindrance for user adoption and a great help for producing an app in a much shorter time span).  Do you have or know of any references on how to structure JavaFX apps as web-apps (i.e. that pull and push data to a server)?

Thirdly, I noticed you have not utilized FXML in these posts. While I find it adds a little complexity it seems to separate concerns quite nicely. I have redone this Timer post in FXML if you are interested.</description>
		<content:encoded><![CDATA[<p>A couple of thoughts:</p>
<p>First, thank you very much for this blog post/tutorial. Your writing is concise and your focus on one &#8220;feature&#8221; makes it much easier to comprehend and build skills with JavaFX.</p>
<p>Second, I have been using GWT for about a year and despite its ability to make stunning web apps, I have found myself fighting against the framework to get relatively simple things done (especially the new RequestFactory and Editor frameworks). JavaFX looks like a nice alternative (except that it runs as a plugin instead of a website which is both a hindrance for user adoption and a great help for producing an app in a much shorter time span).  Do you have or know of any references on how to structure JavaFX apps as web-apps (i.e. that pull and push data to a server)?</p>
<p>Thirdly, I noticed you have not utilized FXML in these posts. While I find it adds a little complexity it seems to separate concerns quite nicely. I have redone this Timer post in FXML if you are interested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on iOS Memory Management: Using Autorelease by Alex Westholm&#187; Blog Archive &#187; Reflections on one month of iOS development</title>
		<link>http://www.asgteach.com/blog/?p=73#comment-47</link>
		<dc:creator>Alex Westholm&#187; Blog Archive &#187; Reflections on one month of iOS development</dc:creator>
		<pubDate>Sat, 11 Feb 2012 15:10:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=73#comment-47</guid>
		<description>[...] While we&#8217;re on the topic, there&#8217;s a variation on release: [variableName autorelease]. This is used in circumstances where you&#8217;d like to mark a variable as no longer having references in a code block where it&#8217;s created, but allow a reference to be created elsewhere (ie, a calling method). Thoughtful readers who have looked around the source a bit will have noticed that some methods return objects but don&#8217;t require us to release them ([NSString stringWithFormat: @&quot;...&quot;] comes to mind) &#8211; that&#8217;s because those methods are autoreleasing. There&#8217;s an excellent write-up of when to use autorelease here. [...]</description>
		<content:encoded><![CDATA[<p>[...] While we&#8217;re on the topic, there&#8217;s a variation on release: [variableName autorelease]. This is used in circumstances where you&#8217;d like to mark a variable as no longer having references in a code block where it&#8217;s created, but allow a reference to be created elsewhere (ie, a calling method). Thoughtful readers who have looked around the source a bit will have noticed that some methods return objects but don&#8217;t require us to release them ([NSString stringWithFormat: @&quot;...&quot;] comes to mind) &#8211; that&#8217;s because those methods are autoreleasing. There&#8217;s an excellent write-up of when to use autorelease here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX: Properties on Steroids by Blog: JavaFX: Properties on Steroids &#124; Oracle &#124; Syngu</title>
		<link>http://www.asgteach.com/blog/?p=408#comment-44</link>
		<dc:creator>Blog: JavaFX: Properties on Steroids &#124; Oracle &#124; Syngu</dc:creator>
		<pubDate>Wed, 30 Nov 2011 06:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=408#comment-44</guid>
		<description>[...] Writer Gail Anderson reviews JavaBean properties and then looks at JavaFX properties in detail.   &#160;   &#160;Oracle     Read the original post on Oracle Technology Network... [...]</description>
		<content:encoded><![CDATA[<p>[...] Writer Gail Anderson reviews JavaBean properties and then looks at JavaFX properties in detail.   &nbsp;   &nbsp;Oracle     Read the original post on Oracle Technology Network&#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX: Properties on Steroids by Florian Brunner</title>
		<link>http://www.asgteach.com/blog/?p=408#comment-43</link>
		<dc:creator>Florian Brunner</dc:creator>
		<pubDate>Mon, 28 Nov 2011 19:52:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=408#comment-43</guid>
		<description>Thanks for the explanation.

Some questions though: 2 typical kinds of applications are e.g.:
Use case 1: access an embedded database with JPA
Use case 2: access a remote Web Service with JAX-WS

Case 1:
How should the JPA entities look like? Should the data layer/ business layer contain JavaFX properties (UI layer)? Or should we duplicate the POJOs - once with &quot;normal&quot; properties and once with JavaFX properties? Other solutions?

Case2:
How can we create JavaFX properties from a WSDL (JAXB)?

It would be great if you (or someone else) could provide some examples for these 2 use cases. (Or point me to them if they already exist.)

Currently I still have the feeling that these JavaFX are really a work-around for a shortcoming in the Java language and I don&#039;t see yet how to make them effectivly work with frameworks such as JPA or JAXB without lot of (alomst) duplicated code.

I guess this is another indicator that Java really needs language level support for properties, which is so fundamental to many frameworks.</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation.</p>
<p>Some questions though: 2 typical kinds of applications are e.g.:<br />
Use case 1: access an embedded database with JPA<br />
Use case 2: access a remote Web Service with JAX-WS</p>
<p>Case 1:<br />
How should the JPA entities look like? Should the data layer/ business layer contain JavaFX properties (UI layer)? Or should we duplicate the POJOs &#8211; once with &#8220;normal&#8221; properties and once with JavaFX properties? Other solutions?</p>
<p>Case2:<br />
How can we create JavaFX properties from a WSDL (JAXB)?</p>
<p>It would be great if you (or someone else) could provide some examples for these 2 use cases. (Or point me to them if they already exist.)</p>
<p>Currently I still have the feeling that these JavaFX are really a work-around for a shortcoming in the Java language and I don&#8217;t see yet how to make them effectivly work with frameworks such as JPA or JAXB without lot of (alomst) duplicated code.</p>
<p>I guess this is another indicator that Java really needs language level support for properties, which is so fundamental to many frameworks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX: Properties on Steroids by Java desktop links of the week, November 28th &#124; Jonathan Giles</title>
		<link>http://www.asgteach.com/blog/?p=408#comment-42</link>
		<dc:creator>Java desktop links of the week, November 28th &#124; Jonathan Giles</dc:creator>
		<pubDate>Sun, 27 Nov 2011 22:56:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=408#comment-42</guid>
		<description>[...] Gail Anderson has blogged about the importance of JavaFX properties. [...]</description>
		<content:encoded><![CDATA[<p>[...] Gail Anderson has blogged about the importance of JavaFX properties. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX: Properties on Steroids by JavaFX links of the week, November 28 // JavaFX News, Demos and Insight // FX Experience</title>
		<link>http://www.asgteach.com/blog/?p=408#comment-41</link>
		<dc:creator>JavaFX links of the week, November 28 // JavaFX News, Demos and Insight // FX Experience</dc:creator>
		<pubDate>Sun, 27 Nov 2011 22:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=408#comment-41</guid>
		<description>[...] Gail Anderson has blogged about the importance of JavaFX properties. [...]</description>
		<content:encoded><![CDATA[<p>[...] Gail Anderson has blogged about the importance of JavaFX properties. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Adding Animation with JavaFX: Spicing Up a Clear by Java desktop links of the week, November 7 &#124; Jonathan Giles</title>
		<link>http://www.asgteach.com/blog/?p=372#comment-37</link>
		<dc:creator>Java desktop links of the week, November 7 &#124; Jonathan Giles</dc:creator>
		<pubDate>Sun, 06 Nov 2011 23:31:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=372#comment-37</guid>
		<description>[...] Gail Anderson continues her series of blog posts, this week her post covers adding animation with JavaFX. [...]</description>
		<content:encoded><![CDATA[<p>[...] Gail Anderson continues her series of blog posts, this week her post covers adding animation with JavaFX. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on JavaFX Sketch Pad: Custom Binding by Java desktop links of the week, October 31 &#124; Jonathan Giles</title>
		<link>http://www.asgteach.com/blog/?p=272#comment-34</link>
		<dc:creator>Java desktop links of the week, October 31 &#124; Jonathan Giles</dc:creator>
		<pubDate>Sun, 30 Oct 2011 23:23:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.asgteach.com/blog/?p=272#comment-34</guid>
		<description>[...] Gail Anderson has put up a blog post on building a JavaFX &#8216;Sketch Pad&#8217; application using custom binding. [...]</description>
		<content:encoded><![CDATA[<p>[...] Gail Anderson has put up a blog post on building a JavaFX &#8216;Sketch Pad&#8217; application using custom binding. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

