<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ngaongan's Blog</title>
	<atom:link href="http://ngaongan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ngaongan.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 06 Dec 2009 22:38:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ngaongan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ngaongan's Blog</title>
		<link>http://ngaongan.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ngaongan.wordpress.com/osd.xml" title="Ngaongan&#039;s Blog" />
	<atom:link rel='hub' href='http://ngaongan.wordpress.com/?pushpress=hub'/>
		<item>
		<title>JavaFX Applets Meet Google Chrome</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/javafx-applets-meet-google-chrome/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/javafx-applets-meet-google-chrome/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:49:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/javafx-applets-meet-google-chrome/</guid>
		<description><![CDATA[In the JFX Custom Nodes category of this blog, graphics designer Mark Dingman of Malden Labs and I have been collaborating on an imaginary Sound Beans application. This category contains a growing series of posts in which we are demonstrating how to create JavaFX UI custom controls. This series also provide a case study in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=208&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://learnjavafx.typepad.com/weblog/jfx_custom_nodes/" title="JFX Custom Nodes category">JFX Custom Nodes category</a> of this blog, graphics designer Mark Dingman of Malden Labs and I have been collaborating on an imaginary <strong>Sound Beans</strong> application. This category contains a growing series of posts in which we are demonstrating how to create JavaFX UI custom controls.  This series also provide a case study in how a graphics designer and an application developer can work together effectively in developing JavaFX applications.  Today I&#8217;d like to highlight the recent Google Chrome browser announcement by showing you how to create and run a JavaFX applet in Chrome.  Here&#8217;s a screenshot of the <a href="http://learnjavafx.typepad.com/weblog/2008/08/tablenode-creat.html" title="TableNode example running as a JavaFX applet">TableNode example from an earlier post</a> running as a JavaFX applet in Chrome:</p>
<p>
<br /><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fc88c88834-pi" style="display:inline;"><img alt="TableNodeExampleApplet" class="at-xid-6a00e54f133d69883400e554fc88c88834 image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fc88c88834-800wi" title="TableNodeExampleApplet" border="0" /></a> </p>
<p>To try this out, first <a href="http://www.google.com/chrome" title="Google Chrome browser site">obtain Google Chrome</a> and install it.  Then <a href="http://java.sun.com/developer/technicalArticles/javase/java6u10/" title="Obtain Java SE 6 Update 10">obtain Java SE 6 Update 10</a> and install it as well.  By the way, installing Java SE 6 update 10 will enable this JavaFX applet to run on Firefox 3 and Internet Explorer as well.  Go ahead and <a href="http://jmentor.com/JFX/TableNodeExampleApplet/TableNodeExamplePage.html" title="Invoke the TableNodeExampleApplet">run this example</a>, being sure to scroll the custom <strong>TableNode</strong> control and to click on its rows.  Also, select the <strong>Burn </strong>icon and move the slider to demonstrate the custom <strong>ProgressNode </strong>control.</p>
<p>
<br /><strong>Looking at the Code</strong></p>
<p>In addition to the <strong>ButtonNode.fx</strong>, <strong>MenuNode.fx</strong>, <strong>DeckNode.fx</strong>, <strong>ProgressNode.fx</strong> and <strong>TableNode.fx</strong> files from <a href="http://learnjavafx.typepad.com/weblog/jfx_custom_nodes/">previous posts in this series</a>, you&#8217;ll need the following files:</p>
<p><strong>TableNodeExampleApplet.fx:</strong></p>
<p><span style="font-size:13px;font-family:Trebuchet MS;"><span style="font-size:11px;font-family:Courier;"><span style="font-size:11px;"><span style="font-size:9px;font-family:Courier;">/*</span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  TableNodeExampleApplet.fx &#8211; </span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  An example of using the TableNode custom node in an Applet.  It also </span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  demonstrates the ProgressNode, DeckNode, MenuNode and ButtonNode </span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  custom nodes</span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *</span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  Developed 2008 by James L. Weaver (jim.weaver at lat-inc.com)</span><br />
<br /><span style="font-size:9px;font-family:Courier;"> *  to demonstrate how to create custom nodes and applets in JavaFX</span><br />
<br /><span style="font-size:9px;font-family:Courier;"> */</span><br />
<br /><span style="font-size:9px;font-family:Courier;">package com.javafxpert.table_node_example.ui;</span></p>
<p><span style="font-size:9px;font-family:Courier;">import javafx.application.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.ext.swing.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.geometry.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.image.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.layout.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.paint.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.text.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import javafx.scene.transform.*;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import java.lang.Object;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import java.lang.System;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.custom_node.DeckNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.custom_node.TableNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.custom_node.ProgressNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.custom_node.ButtonNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.custom_node.MenuNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">import com.javafxpert.table_node_example.model.TableNodeExampleModel;</span></p>
<p><span style="font-size:9px;font-family:Courier;">var deckRef:DeckNode;</span></p>
<p><span style="font-size:9px;font-family:Courier;">Application {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">  var model = TableNodeExampleModel.getInstance();</span><br />
<br /><span style="font-size:9px;font-family:Courier;">  var stageRef:Stage;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">  var menuRef:MenuNode;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">  stage:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">    stageRef = Stage {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">      fill: Color.BLACK</span><br />
<br /><span style="font-size:9px;font-family:Courier;">      content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">        deckRef = DeckNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          fadeInDur: 700ms</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            // The "Splash" page</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            Group {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              var vboxRef:VBox;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              var splashFont =</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                Font {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  name: "Sans serif"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  style: FontStyle.BOLD</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  size: 12</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                };</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              id: "Splash"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                ImageView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  image: </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Image {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      url: "{__DIR__}images/splashpage.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    } </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                vboxRef = VBox {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  translateX: bind stageRef.width - vboxRef.getWidth() - 10 </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  translateY: 215</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  spacing: 1</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: "A Fictitious Audio Application that Demonstrates"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      fill: Color.WHITE</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font: splashFont</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: "Creating JavaFX Custom Nodes"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      fill: Color.WHITE</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font: splashFont</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: "Application Developer: Jim Weaver"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      fill: Color.WHITE</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font: splashFont</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: "Graphics Designer: Mark Dingman"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      fill: Color.WHITE</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font: splashFont</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            // The &#8220;Play&#8221; page</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            VBox {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              var tableNode:TableNode</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              id: &#8220;Play&#8221;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              spacing: 4</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                Group {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    ImageView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      image: </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        Image {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          url: "{__DIR__}images/playing_currently.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      textOrigin: TextOrigin.TOP</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: bind "{tableNode.selectedIndex}"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font: Font {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        size: 24</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  ] </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                tableNode = TableNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  height: 135</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  rowHeight: 25</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  rowSpacing: 2</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  columnWidths: [150, 247, 25, 70]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  tableFill: Color.BLACK </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  rowFill: Color.#1c1c1c</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  selectedRowFill: Color.#2d2d2d</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  selectedIndex: -1</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  vertScrollbarWidth: 20</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  vertScrollbarFill: LinearGradient {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    startX: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    startY: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    endX: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    endY: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    stops: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        offset: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        color: Color.#0b0b0b</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        offset: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        color: Color.#343434</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  vertScrollbarThumbFill: Color.#efefef</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  content: bind </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    for (obj in model.playlistObjects) {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      if (obj instanceof String)</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          textOrigin: TextOrigin.TOP</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          fill: Color.#b7b7b7</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          content: obj as String</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          font:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Font {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              size: 11</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      else if (obj instanceof Image)</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        ImageView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          image: obj as Image</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      else</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        null</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  onSelectionChange:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    function(row:Integer):Void {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      System.out.println(&#8220;Table row #{row} selected&#8221;);</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            // The &#8220;Burn&#8221; page</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            Group {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              var vboxRef:VBox;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              id: &#8220;Burn&#8221;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                vboxRef = VBox {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  translateX: bind stageRef.width / 2 - vboxRef.getWidth() / 2</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  translateY: bind stageRef.height / 2 - vboxRef.getHeight() / 2</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  spacing: 15</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Text {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      textOrigin: TextOrigin.TOP</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      content: "Burning custom playlist to CD..."</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      font:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        Font {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          name: "Sans serif"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          style: FontStyle.PLAIN</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          size: 22</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      fill: Color.#d3d3d3</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    ProgressNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      width: 430</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      height: 15</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      progressPercentColor: Color.#bfdfef</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      progressTextColor: Color.#0c1515</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      progressText: bind "{model.remainingBurnTime} Remaining"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      progressFill:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        LinearGradient {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          startX: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          startY: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          endX: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          endY: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          stops: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              offset: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              color: Color.#00c0ff</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              offset: 0.20</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              color: Color.#00acea</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              offset: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              color: Color.#0070ae</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      barFill:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        LinearGradient {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          startX: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          startY: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          endX: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          endY: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          stops: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              offset: 0.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              color: Color.#707070</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Stop {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              offset: 1.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              color: Color.#585858</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      progress: bind model.burnProgressPercent / 100.0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    ComponentView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      component:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        FlowPanel {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          background: Color.BLACK</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Label {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              text: "Slide to simulate burn progress:"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              foreground: Color.#d3d3d3</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            Slider {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              orientation: Orientation.HORIZONTAL</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              minimum: 0</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              maximum: 100</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              value: bind model.burnProgressPercent with inverse</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                              preferredSize: [200, 20]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                            }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                          ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    } </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            // The &#8220;Config&#8221; page</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            Group {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              id: &#8220;Config&#8221;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                ImageView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  image: </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Image {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      url: "{__DIR__}images/config.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    } </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            // The &#8220;Help&#8221; page</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            Group {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              id: &#8220;Help&#8221;</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              content: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                ImageView {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  image: </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    Image {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                      url: "{__DIR__}images/help.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                    } </span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">        },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">        menuRef = MenuNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          translateX: bind stageRef.width / 2 &#8211; menuRef.getWidth() / 2</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          translateY: bind stageRef.height &#8211; menuRef.getHeight()</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          buttons: [</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            ButtonNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              title: "Play"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              imageURL: "{__DIR__}icons/play.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              action:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                function():Void {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  deckRef.visibleNodeId = "Play";</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            ButtonNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              title: "Burn"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              imageURL: "{__DIR__}icons/burn.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              action:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                function():Void {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  deckRef.visibleNodeId = "Burn";</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            ButtonNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              title: "Config"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              imageURL: "{__DIR__}icons/config.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              action:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                function():Void {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  deckRef.visibleNodeId = "Config";</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            ButtonNode {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              title: "Help"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              imageURL: "{__DIR__}icons/help.png"</span><br />
<br /><span style="font-size:9px;font-family:Courier;">              action:</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                function():Void {</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                  deckRef.visibleNodeId = "Help";</span><br />
<br /><span style="font-size:9px;font-family:Courier;">                }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">            },</span><br />
<br /><span style="font-size:9px;font-family:Courier;">          ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">        }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">      ]</span><br />
<br /><span style="font-size:9px;font-family:Courier;">    }</span><br />
<br /><span style="font-size:9px;font-family:Courier;">}</span><br />
<br /></span></span><br />
<br /></span>  </p>
<p>
<br />Note that the <strong>Application </strong>class has a <strong>stage </strong>attribute just as the <strong>Frame </strong>had in previous examples.  Here&#8217;s the <strong>TableNodeExamplePage.html</strong> file that you&#8217;ll open in your browser.  The <strong>draggable param</strong>, by the way, enables that neat &#8220;pull the applet out of the browser&#8221; trick that I&#8217;ll show you in a bit:</p>
<p style="font-size:10px;font-family:Courier;">
<p>      &lt;applet code=&quot;javafx.application.Applet&quot; width=500 height=400<br />
<br />          archive=&#8221;javafxrt.jar, Scenario.jar, javafxgui.jar, javafx-swing.jar, TableNodeExample.jar&#8221;&gt;</p>
<p></p>
<p>
<br />Finally, here&#8217;s the Java Web Start <strong>TableNodeExampleApplet.jnlp </strong>file that is used by the HTML file above:</p>
<p style="font-size:11px;font-family:Courier;">
<p>    TableNodeExampleApplet<br />
<br />    JMentor<br />
<br />    TableNodeExampleApplet<br />
<br />    TableNodeExampleApplet</p>
<p>    <!--j2se version="1.6+" java-vm-args="-Xmx800m" /--></p>
<p>  &lt;applet-desc<br />
<br />    name=&#8221;TableNodeExampleApplet&#8221;<br />
<br />    main-class=&#8221;javafx.application.Applet&#8221;<br />
<br />    width=&#8221;500&#8243;<br />
<br />    height=&#8221;400&#8243;&gt;</p>
<p><strong><br />
<br /></strong><strong>Dragging the Applet out of the Browser and onto the Desktop<br />
<br /></strong></p>
<p>As shown in the following screenshot, one of the cool features of Java SE 6 update 10 is that you can drag a Java or JavaFX applet out of the browser and onto the desktop.  By default, you press the <strong>Alt</strong> key while dragging the applet:</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554df69b18833-pi" style="display:inline;"><img alt="TableNodeExampleApplet-Drag" class="at-xid-6a00e54f133d69883400e554df69b18833 " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554df69b18833-800wi" title="TableNodeExampleApplet-Drag" border="0" /></a> </p>
<p>Here is our JavaFX Applet living happily on the desktop after the browser has been closed, and the user has selected the <strong>Burn </strong>page:</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fce3d28834-pi" style="display:inline;"><img alt="TableNodeExampleApplet-Dragged" class="at-xid-6a00e54f133d69883400e554fce3d28834 image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fce3d28834-800wi" title="TableNodeExampleApplet-Dragged" border="0" /></a> </p>
<p><strong>Google Chrome will be a Driving Force for RIA<br />
<br /></strong></p>
<p>According to Google, <a href="http://www.google.com/support/chrome/bin/answer.py?answer=95282&amp;topic=14687" title="Google Chrome requires Java SE 6 Update 10 to run Java">Java SE 6 Update 10 is the version that must be used in order to run Java</a> in the Chrome browser.  As I&#8217;ve mentioned previously, one of the objectives of Java SE 6 Update 10 is to solve the JRE and Java/JavaFX deployment issues.  Because Google Chrome is destined to be a great, cross-platform browser, and because it requires the version of Java that makes rich-client Java/JavaFX programs feasible, this will increase the adoption rate of JavaFX applets and applications.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=208&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/javafx-applets-meet-google-chrome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fc88c88834-800wi" medium="image">
			<media:title type="html">TableNodeExampleApplet</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554df69b18833-800wi" medium="image">
			<media:title type="html">TableNodeExampleApplet-Drag</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883400e554fce3d28834-800wi" medium="image">
			<media:title type="html">TableNodeExampleApplet-Dragged</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Java Deployment Toolkit with JavaFX Applets</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/using-the-java-deployment-toolkit-with-javafx-applets/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/using-the-java-deployment-toolkit-with-javafx-applets/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:47:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/using-the-java-deployment-toolkit-with-javafx-applets/</guid>
		<description><![CDATA[Using the Java Deployment Toolkit with JavaFX Applets First, let me apologize for resurrecting the very humble JavaFX program shown below, but I want to keep this example very succinct. This will enable you to use it as &#8220;starter code&#8221; for JavaFX applet deployment. Note: To see more functional JavaFX programs, please see articles in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=207&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3 class="entry-header">Using the Java Deployment Toolkit with JavaFX Applets</h3>
<p>First, let me apologize for <a href="http://learnjavafx.typepad.com/weblog/2008/02/binding-to-a-fu.html">resurrecting the very humble JavaFX program</a><span style="font-family:Trebuchet MS;"> </span>shown below, but I want to keep this example very succinct.  This will enable you to use it as &#8220;starter code&#8221; for JavaFX applet deployment.  Note: To see more functional JavaFX programs, please see articles in the <a href="http://learnjavafx.typepad.com/weblog/jfx_custom_nodes/">JFX Custom Nodes category</a>.</p>
<p><a style="display:inline;" href="http://jmentor.com/JFX/BindToFunctionApplet/BindToFunctionPage.html"><img class="at-xid-6a00e54f133d698834010534ba563a970c image-full " alt="BindToFunctionApplet_SDK_Preview" title="BindToFunctionApplet_SDK_Preview" src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010534ba563a970c-pi" border="0" /></a><br />
 </p>
<p><strong>Note: Thanks to reader &#8220;mbien&#8221; (see comments) for pointing our that the colors of the original applet in this post were hideous (my words).  I then consulted graphics designer Mark Dingman of Malden Labs who gave me a graphical mock-up from which I created the above applet.</strong>  Here&#8217;s the code for this applet, updated for the JavaFX SDK preview:</p>
<pre>/*
 *  BindToFunctionApplet.fx - A compiled JavaFX program that demonstrates
 *                            how to create JavaFX applets.
 *                            It also demonstrates binding to a function.
 *
 *  Developed 2008 by Jim Weaver (development) and Mark Dingman (graphic design)
 *  to serve as a JavaFX Script example.
 */
package com.javafxpert.bind_to_function;

import javafx.application.*;
import javafx.ext.swing.*;
import javafx.scene.*;
import javafx.scene.geometry.*;
import javafx.scene.paint.*;
import javafx.scene.text.*;
import javafx.scene.transform.*;
import java.lang.Math;

class CircleModel {
  attribute diameter:Integer;

  bound function getArea():Number {
    Math.PI * Math.pow(diameter / 2, 2);
  }
}

Application {
  var cModel = CircleModel {};
  var componentViewRef:ComponentView;
  var stageRef:Stage;
  stage:
    stageRef = Stage {
      var labelFont = Font {
        name: "Sans Serif"
        style: FontStyle.PLAIN
        size: 32
      }
      fill:
        LinearGradient {
          startX: 0.0
          startY: 0.0
          endX: 0.0
          endY: 1.0
          stops: [
            Stop {
              offset: 0.0
              color: Color.rgb(0, 168, 255)
            },
            Stop {
              offset: 1.0
              color: Color.rgb(0, 65, 103)
            }
          ]
        }
      content: [
        Circle {
          centerX: 250
          centerY: 250
          radius: bind cModel.diameter / 2
          fill:
            LinearGradient {
              startX: 0.0
              startY: 0.0
              endX: 0.0
              endY: 1.0
              stops: [
                Stop {
                  offset: 0.0
                  color: Color.rgb(74, 74, 74)
                },
                Stop {
                  offset: 1.0
                  color: Color.rgb(9, 9, 9)
                }
              ]
            }
        },
        Text {
          font: labelFont
          x: 30
          y: 70
          fill: Color.BLACK
          content: bind "Diameter: {cModel.diameter}"
        },
        Text {
          font: labelFont
          x: 260
          y: 70
          fill: Color.BLACK
          content: bind "Area: {%3.2f cModel.getArea()}"
        },
        componentViewRef = ComponentView {
          transform: bind
            Translate.translate(40, stageRef.height - 30 -
                                   componentViewRef.getHeight())
          component:
            Slider {
              minimum: 0
              maximum: 400
              preferredSize: bind [stageRef.width - 80, 20]
              value: bind cModel.diameter with inverse
            }
        }
      ]
    }
}
</pre>
<p><strong>Why Use the Java Deployment Toolkit for Java Applets?<br />
<br /></strong></p>
<p>According to <a href="http://java.sun.com/javase/downloads/ea/6u10/deploymentToolkit.jsp">Sun&#8217;s Java Deployment Toolkit overview page</a>, &#8220;<em>Desktop clients have a wide variety of Java Platforms installed, from the Microsft VM to Sun&#8217;s latest Java SE 6 updates. They run various operating systems from Sun, Microsoft, Apple, Red Hat, and others, and are connected to the internet at a wide range of connection speeds. How are content providers to deliver Java content to all of these clients with the best possible user experience?</p>
<p>Various sources have published JavaScript techniques for detecting and deploying the Java Platform for use by Java Plug-In applets and Java Web Start applications. These scripts generally have serious limitations and fail to support the varied combinations of browser, OS, and configuration options found on today&#8217;s clients.</p>
<p>The Java Deployment Toolkit allows developers to easily deploy applets and applications to a large variety of clients with JavaScripts. It also provides advice on using some of the most powerful features available in Java Web Start and Java Plug-In, and an outline of the differences between these two deployment vehicles.</em>&#8220;</p>
<p>In a nutshell, the Java Deployment Toolkit is a JavaScript library maintained by Sun and always available at runtime by your HTML code.  This library has several methods that perform tasks such as sensing Java-related infrastructure and installing the JRE on client machines.  We&#8217;ll use one of these methods, namely <strong>runApplet</strong>, to run a JavaFX applet with a specified minimum JRE version.  Here&#8217;s the HTML and JavaScript code I&#8217;m using to deploy today&#8217;s example applet:</p>
<pre><span style="font-size:13px;font-family:Arial;"></span>
<span style="font-size:13px;font-family:Arial;"></span>
<span style="font-size:13px;font-family:Arial;"></span>
<span style="font-size:13px;font-family:Arial;">  var attributes = {codebase:'http://jmentor.com/JFX/BindToFunctionApplet',</span>
<span style="font-size:13px;font-family:Arial;">    code:'javafx.application.Applet.class',</span>
<span style="font-size:13px;font-family:Arial;">    archive:'BindToFunctionApplet.jar, javafxrt.jar, Scenario.jar, javafxgui.jar, javafx-swing.jar',</span>
<span style="font-size:13px;font-family:Arial;">    width:500, height:500, java_arguments:'-Djnlp.packEnabled=true'};</span>
<span style="font-size:13px;font-family:Arial;">  var parameters = {"ApplicationClass":"com.javafxpert.bind_to_function.BindToFunctionApplet",</span>
<span style="font-size:13px;font-family:Arial;">                    "draggable":"true"};</span>
<span style="font-size:13px;font-family:Arial;">  var version = '1.6.0' ;</span>
<span style="font-size:13px;font-family:Arial;">  deployJava.runApplet(attributes, parameters, version);</span>
<span style="font-size:13px;font-family:Arial;"></span>
<span style="font-size:13px;font-family:Arial;"></span>
</pre>
<p>
<br />Notice that the above code enables dragging the applet onto the desktop, as well as using Pack200 formatted JAR files, if the client machine has Java SE 6 update 10 installed.  <a href="http://jmentor.com/JFX/BindToFunctionApplet/BindToFunctionPage.html">Give the applet a whirl</a> to see its deployment behavior on your machine.  By the way, according to <a href="http://java.sun.com/javase/downloads/ea/6u10/plugin2/index.jsp#EXPERIMENTAL_FUNCTIONALITY">the Java SE 6 Update 10 plug-in docs</a>, &#8220;by default, the gesture to drag the applet out of the web browser is Alt + Left click + Drag.&#8221;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/207/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=207&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/using-the-java-deployment-toolkit-with-javafx-applets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010534ba563a970c-pi" medium="image">
			<media:title type="html">BindToFunctionApplet_SDK_Preview</media:title>
		</media:content>
	</item>
		<item>
		<title>Six Degrees of Aynsley Dunbar: BandmatesFX Example JavaFX App Continued</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/six-degrees-of-aynsley-dunbar-bandmatesfx-example-javafx-app-continued/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/six-degrees-of-aynsley-dunbar-bandmatesfx-example-javafx-app-continued/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:46:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/six-degrees-of-aynsley-dunbar-bandmatesfx-example-javafx-app-continued/</guid>
		<description><![CDATA[So far in this Freebase Contributing Artists App series, we&#8217;ve been developing a JavaFX application that enables the user to navigate connections among musicians. I&#8217;m calling this application BandmatesFX, and it uses the JSONHandler feature of the JFXtras open source library to easily query the Freebase.com database. Note: While using this app, I noticed that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=206&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So far in this <a href="http://learnjavafx.typepad.com/weblog/freebase-contributing-artists-app/" target="_blank">Freebase Contributing Artists App</a> series, we&#8217;ve been developing a JavaFX application that enables the user to navigate connections among musicians.  I&#8217;m calling this application BandmatesFX, and it uses the JSONHandler feature of the JFXtras open source library to easily query the <strong>Freebase.com</strong> database.</p>
<p>Note: While using this app, I noticed that drummer <a href="http://en.wikipedia.org/wiki/Aynsley_Dunbar" target="_blank">Aynsley Dunbar</a> has played with lots of bands over the years, so he&#8217;s a good starting point for trying to navigate to another given musician in six or less degrees.  Try, for example, to navigate from Aynsley Dunbar to Roy Orbison.  Here&#8217;s one way in five degrees:</p>
<ol>
<li>Aynsley Dunbar played in The Animals, with Andy Summers</li>
<li>Andy Summers played in The Police, with Sting</li>
<li>Sting played in Band Aid, with Paul McCartney</li>
<li>Paul McCartney played in The Quarrymen (and of course The Beatles), with George Harrison</li>
<li>George Harrison played in The Traveling Wilburys, with Roy Orbison</li>
</ol>
<p>Today I&#8217;m going to point out some enhancements to this application, and the updated code, which are reflected in the following screenshot:</p>
<p><a href="http://jmentor.com/JavaFX_1-2/BandmatesFXnext/BandmatesFX.jnlp" style="display:inline;"><img alt="BandmatesFX_Aynsley_small" class="at-xid-6a00e54f133d69883401157138ebbd970c image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401157138ebbd970c-800wi" title="BandmatesFX_Aynsley_small" border="0" /></a> </p>
<p>These enhancements include:</p>
<ul>
<li>The user can type in an artist name, and with each keystroke the Freebase database web service is invoked, returning suggested names from which the user can choose.</li>
<li>Band and artist pictures are presented in a cover-flow style, using the JFXtras <strong>Shelf</strong> component.  In addition, the JFXtras <strong>TitledBorder </strong>component is employed to enclose and label the cover-flows.</li>
<li>When the user clicks the central image in the bottom (e.g. Steve Smith in the screenshot above), that artist becomes the featured artist at the top of the page.  The group cover-flow images are updated to reflect the groups in which the artist has played, and the member cover-flow images contain the artists that have played in the currently selected group.</li>
</ul>
<p>One of the cool feature of the JFXtras <strong>Shelf </strong>component is that the mouse wheel moves the images horizontally on the Shelf, enabling the user to navigate even more quickly than clicking on one of the images.  Before invoking this application from the Web Start link at the end of this article, take a look at the main script of the program (named <strong>BandmatesFX.fx</strong>) in the listing below:</p>
<pre>/** BandmatesMain.fx** Uses Freebase and JFXtras with JavaFX to explore connections* between musical artists** Developed by James L. Weaver to demonstrate using JavaFX and JFXtras*/

package javafxpert;

import javafx.io.http.HttpRequest;import javafx.animation.transition.*;import javafx.geometry.HPos;import javafx.scene.*;import javafx.scene.control.Label;import javafx.scene.control.ProgressIndicator;import javafx.scene.control.ListView;import javafx.scene.control.TextBox;import javafx.scene.image.*;import javafx.scene.input.*;import javafx.scene.layout.*;import javafx.scene.paint.*;import javafx.scene.text.*;import javafx.stage.Stage;

import org.jfxtras.data.pull.*;import org.jfxtras.scene.border.TitledBorder;import org.jfxtras.scene.control.Shelf;

/*** Height of the images that we'll be working with*/def IMAGE_HEIGHT:Integer = 140;

/*** Artist for which we're searching bandmates*/var artistToSearch:String = "/en/aynsley_dunbar";

/*** Name for which we're finding matches and ids*/var nameToFind:String = "Aynsley Dunbar";

var textBoxRef:TextBox;var listViewRef:ListView;var selectedNameIndex = bind listViewRef.selectedIndex on replace {  def selectedId = freebaseSearchResult.result[selectedNameIndex].id;  if (selectedId != "") {    println("selectedId:{selectedId}");    nameToFind = freebaseSearchResult.result[selectedNameIndex].name;    obtainGroupsForArtist(selectedId);  }};

/*** Hover text that contains the name of the artist or group*/var nameHoverText:String;

/*** A reference to the HTTP request, for the purpose of monitoring progress*/var req:HttpRequest;

/*** The root class that will hold the object graph from the JSON results*/var freebaseResult:FreebaseResult;

/*** The root class that will hold the object graph from the JSON results*/var freebaseSearchResult:FreebaseSearchResult;

/*** The base URL for the freebase query*/def freebaseURL = "http://www.freebase.com/api/service/mqlread?";

/*** The base URL for a freebase search request*/def freebaseSearchURL = "http://www.freebase.com/api/service/search?";

/*** The base URL to get a freebase image*/def freebaseImageURL = "http://img.freebase.com/api/trans/image_thumb";

var artistsNode:Node;

/*** Fade in transition for artists*/def shelfFadeIn = FadeTransition {  node: bind artistsNode  duration: 1500ms  fromValue: 0.2  toValue: 1.0}

/*** Indexe into groups list*/var groupOneIndex:Integer on replace {  shelfFadeIn.playFromStart();

  // Choose the middle one  def numArtists:Integer = sizeof freebaseResult.result.                          musicGroupMemberMembership[groupOneIndex].                          group.musicMusicalGroupMember;  artistTwoIndex = if (numArtists &gt; 1) numArtists / 2 else 0;

  groupOneName = freebaseResult.result.                 musicGroupMemberMembership[groupOneIndex].group.name;};

/*** Name of the currently selected band*/var groupOneName:String;

/*** Index into artists list*/var artistTwoIndex:Integer;

/*** Create a search query and invoke the JSON handler*/function obtainIdForArtistPartialName(artistPartialName:String) {  listViewRef.visible = true;  nameToFind = artistPartialName;  def partialName = artistPartialName.replace(" ", "+");  var searchUrl = "{freebaseSearchURL}prefix={partialName}&amp;type=/music/artist&amp;limit=10&amp;mql_output=[\{\"id\":null,\"name\":null\}]";

  println("searchUrl:{searchUrl}");  var albumHandler:JSONHandler = JSONHandler {    rootClass: "javafxpert.FreebaseSearchResult"    onDone: function(obj, isSequence): Void {      freebaseSearchResult = obj as FreebaseSearchResult;      println("# of search results:{sizeof freebaseSearchResult.result},freebaseSearchResult:{freebaseSearchResult.code}");      req.stop();    }  };  req = HttpRequest {    location: searchUrl    onInput: function(is: java.io.InputStream) {      albumHandler.parse(is);    }  };  req.start();}

/*** Create the Freebase query and invoke the JSON handler*/function obtainGroupsForArtist(artistFreebaseId:String) {  listViewRef.visible = false;  artistToSearch = artistFreebaseId;  var queryUrl = "{freebaseURL}query=\{\"query\":"    " \{ "    "   \"/common/topic/image\": [\{ "    "     \"id\": null "    "   \}], "    "   \"/music/group_member/membership\": [\{ "    "     \"group\": \{ "    "       \"name\": null, "    "       \"id\":   null, "    "       \"/common/topic/image\": [\{ "    "         \"id\": null "    "       \}], "    "       \"/music/musical_group/member\": [\{ "    "         \"member\": \{ "    "           \"name\": null, "    "           \"id\":   null, "    "           \"/common/topic/image\": [\{ "    "             \"id\": null "    "           \}] "    "         \} "    "       \}] "    "     \} "    "   \}], "    "   \"id\":   \"{artistFreebaseId}\", "    "   \"name\": null, "    "   \"type\": \"/music/artist\" "    " \} \}";

  println("queryUrl:{queryUrl}");  var albumHandler:JSONHandler = JSONHandler {    rootClass: "javafxpert.FreebaseResult"    onDone: function(obj, isSequence): Void {      freebaseResult = obj as FreebaseResult;      println("# of bands:{sizeof freebaseResult.result.musicGroupMemberMembership}");      req.stop();

      // Choose the middle one      def numGroups:Integer = sizeof freebaseResult.result.musicGroupMemberMembership;      groupOneIndex = if (numGroups &gt; 1) numGroups / 2 else 0;    }  };  req = HttpRequest {    location: queryUrl    onInput: function(is: java.io.InputStream) {      albumHandler.parse(is);    }  };  req.start();}var sceneRef:Scene;

Stage {  title: bind "BandmatesFX - {nameToFind}"  scene: sceneRef = Scene {    width: 1000    height: 700    content: [      ImageView {        image: Image {          url: "http://www.popsci.com/files/imagecache/article_image_large/files/articles/guitar.gif"        }        fitWidth: bind sceneRef.width        preserveRatio: true        opacity: 0.1      },      VBox {        nodeHPos: HPos.CENTER        layoutY: 10        spacing: 10        content: [          HBox {            spacing: 10            content: [              ImageView {                image: bind Image {                  url: "{freebaseImageURL}{artistToSearch}?maxheight={IMAGE_HEIGHT}"                }              },              VBox {                content: [                  textBoxRef = TextBox {                    promptText: "Enter artist name"                    text: bind nameToFind with inverse                    columns: 20                    font: Font.font(null, 14)                    action:function():Void {                      if (nameToFind != "" and (req.percentDone == 0.0 or req.percentDone == 100.0)) {                        obtainIdForArtistPartialName(nameToFind);                      }                    }                    onKeyTyped:function(ke:KeyEvent) {                      println("req.percentDone:{req.percentDone}");                      if (textBoxRef.rawText != "" and (req.percentDone == 0.0 or req.percentDone == 100.0)) {                        obtainIdForArtistPartialName(textBoxRef.rawText);                      }                    }                  },                  listViewRef = ListView {                    visible: false                    height: 100                    items: bind for (rslt in freebaseSearchResult.result) {                      rslt.name                    }                    layoutInfo: LayoutInfo {                      width: bind textBoxRef.width - 10                      height: 80                    }                  }                ]              },              ProgressIndicator {                progress: bind req.progress              },              Label {                text: bind nameHoverText                font: Font.font(null, FontWeight.BOLD, 18)              }            ]          },          TitledBorder {            text: bind "{nameToFind} played in these groups:"            font: Font.font(null, FontWeight.BOLD, 14)            lineColor: Color.GREY            node: Shelf {              reflection: false              showScrollBar: false              showText: true              imageUrls: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {                "{freebaseImageURL}{grp.group.id}?maxheight={IMAGE_HEIGHT}"              }              imageNames: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {                grp.group.name;              }              index: bind groupOneIndex with inverse              thumbnailWidth: IMAGE_HEIGHT              thumbnailHeight: IMAGE_HEIGHT              layoutInfo: LayoutInfo {                width: bind sceneRef.width                height: IMAGE_HEIGHT + 120              }            }          },          artistsNode = Panel {            content: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {              TitledBorder {                text: bind "{groupOneName} has had the following members:"                font: Font.font(null, FontWeight.BOLD, 14)                lineColor: Color.GREY                node: Shelf {                  visible: bind indexof grp == groupOneIndex                  reflection: false                  showScrollBar: false                  showText: true                  imageUrls: bind for (mmbr in freebaseResult.result.                                           musicGroupMemberMembership[indexof grp].                                           group.musicMusicalGroupMember) {                    "{freebaseImageURL}{mmbr.member.id}?maxheight={IMAGE_HEIGHT}"                  }                  imageNames: bind for (mmbr in freebaseResult.result.                                           musicGroupMemberMembership[indexof grp].                                           group.musicMusicalGroupMember) {                    mmbr.member.name                  }                  onCenterImagePressed:function(me:MouseEvent):Void {                    var mmbr = freebaseResult.result.                               musicGroupMemberMembership[indexof grp].                               group.musicMusicalGroupMember[artistTwoIndex];                    nameToFind = mmbr.member.name;                    artistToSearch = mmbr.member.id;                    obtainGroupsForArtist(mmbr.member.id);                  }                  index: bind artistTwoIndex with inverse                  thumbnailWidth: IMAGE_HEIGHT                  thumbnailHeight: IMAGE_HEIGHT                  layoutInfo: LayoutInfo {                    width: bind sceneRef.width                    height: IMAGE_HEIGHT + 120                  }                }              }            }            layoutInfo: LayoutInfo {              width: bind sceneRef.width              height: IMAGE_HEIGHT + 120            }          }        ]      }    ]  }}obtainGroupsForArtist(artistToSearch);</pre>
<p>To try out this application, click the Web Start link below.  Since this application is a work in progress, I&#8217;ll give you a couple of pointers:</p>
<ul>
<li>When typing the name of an artist in the text box, each key invokes a web service, so wait until the progress indicator is solid before typing the final character (I&#8217;ll make this smoother in a future iteration).</li>
<li>Not all artists are in groups, and I&#8217;m not doing the necessary exception handling yet to catch this in the response from Freebase.  I know that many artists such as Eric Clapton, Bob Dylan, and Steve Winwood work, as well as any artist that you can click in the bottom cover flow (by definition they are members of a group).</li>
</ul>
<p>  <a href="http://jmentor.com/JavaFX_1-2/BandmatesFXnext/BandmatesFX.jnlp"><img alt="Webstartsmall2" src="http://learnjavafx.typepad.com/weblog/images/2008/07/23/webstartsmall2.gif" title="Webstartsmall2" border="0" height="34" width="88" /></a>  </p>
<p>For more background on this application, see the <a href="http://learnjavafx.typepad.com/weblog/2009/07/leveraging-jfxtras-and-freebase-with-javafx-to-create-bandmatesfx.html" target="_blank">previous article</a> in this series.  As always, please leave a comment if you have any questions.  Also, if you have any suggestions for future enhancements, please leave a comment as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/206/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/206/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/206/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=206&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/six-degrees-of-aynsley-dunbar-bandmatesfx-example-javafx-app-continued/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401157138ebbd970c-800wi" medium="image">
			<media:title type="html">BandmatesFX_Aynsley_small</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/07/23/webstartsmall2.gif" medium="image">
			<media:title type="html">Webstartsmall2</media:title>
		</media:content>
	</item>
		<item>
		<title>Freebase Contributing Artists App</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/freebase-contributing-artists-app/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/freebase-contributing-artists-app/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:45:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/freebase-contributing-artists-app/</guid>
		<description><![CDATA[Six Degrees of Aynsley Dunbar: BandmatesFX Example JavaFX App Continued So far in this Freebase Contributing Artists App series, we&#8217;ve been developing a JavaFX application that enables the user to navigate connections among musicians. I&#8217;m calling this application BandmatesFX, and it uses the JSONHandler feature of the JFXtras open source library to easily query the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=205&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/07/six-degrees-of-aynsley-dunbar-bandmatesfx-example-app-continued.html">Six Degrees of Aynsley Dunbar: BandmatesFX Example JavaFX App Continued</a></h3>
<p>So far in this <a href="http://learnjavafx.typepad.com/weblog/freebase-contributing-artists-app/" target="_blank">Freebase Contributing Artists App</a> series, we&#8217;ve been developing a JavaFX application that enables the user to navigate connections among musicians.  I&#8217;m calling this application BandmatesFX, and it uses the JSONHandler feature of the JFXtras open source library to easily query the <strong>Freebase.com</strong> database.</p>
<p>Note: While using this app, I noticed that drummer <a href="http://en.wikipedia.org/wiki/Aynsley_Dunbar" target="_blank">Aynsley Dunbar</a> has played with lots of bands over the years, so he&#8217;s a good starting point for trying to navigate to another given musician in six or less degrees.  Try, for example, to navigate from Aynsley Dunbar to Roy Orbison.  Here&#8217;s one way in five degrees:</p>
<ol>
<li>Aynsley Dunbar played in The Animals, with Andy Summers</li>
<li>Andy Summers played in The Police, with Sting</li>
<li>Sting played in Band Aid, with Paul McCartney</li>
<li>Paul McCartney played in The Quarrymen (and of course The Beatles), with George Harrison</li>
<li>George Harrison played in The Traveling Wilburys, with Roy Orbison</li>
</ol>
<p>Today I&#8217;m going to point out some enhancements to this application, and the updated code, which are reflected in the following screenshot:</p>
<p><a href="http://jmentor.com/JavaFX_1-2/BandmatesFXnext/BandmatesFX.jnlp" style="display:inline;"><img alt="BandmatesFX_Aynsley_small" class="at-xid-6a00e54f133d69883401157138ebbd970c image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401157138ebbd970c-800wi" title="BandmatesFX_Aynsley_small" border="0" /></a> </p>
<p>These enhancements include:</p>
<ul>
<li>The user can type in an artist name, and with each keystroke the Freebase database web service is invoked, returning suggested names from which the user can choose.</li>
<li>Band and artist pictures are presented in a cover-flow style, using the JFXtras <strong>Shelf</strong> component.  In addition, the JFXtras <strong>TitledBorder </strong>component is employed to enclose and label the cover-flows.</li>
<li>When the user clicks the central image in the bottom (e.g. Steve Smith in the screenshot above), that artist becomes the featured artist at the top of the page.  The group cover-flow images are updated to reflect the groups in which the artist has played, and the member cover-flow images contain the artists that have played in the currently selected group.</li>
</ul>
<p>One of the cool feature of the JFXtras <strong>Shelf </strong>component is that the mouse wheel moves the images horizontally on the Shelf, enabling the user to navigate even more quickly than clicking on one of the images.  Before invoking this application from the Web Start link at the end of this article, take a look at the main script of the program (named <strong>BandmatesFX.fx</strong>) in the listing below:</p>
<pre>/** BandmatesMain.fx** Uses Freebase and JFXtras with JavaFX to explore connections* between musical artists** Developed by James L. Weaver to demonstrate using JavaFX and JFXtras*/

package javafxpert;

import javafx.io.http.HttpRequest;import javafx.animation.transition.*;import javafx.geometry.HPos;import javafx.scene.*;import javafx.scene.control.Label;import javafx.scene.control.ProgressIndicator;import javafx.scene.control.ListView;import javafx.scene.control.TextBox;import javafx.scene.image.*;import javafx.scene.input.*;import javafx.scene.layout.*;import javafx.scene.paint.*;import javafx.scene.text.*;import javafx.stage.Stage;

import org.jfxtras.data.pull.*;import org.jfxtras.scene.border.TitledBorder;import org.jfxtras.scene.control.Shelf;

/*** Height of the images that we'll be working with*/def IMAGE_HEIGHT:Integer = 140;

/*** Artist for which we're searching bandmates*/var artistToSearch:String = "/en/aynsley_dunbar";

/*** Name for which we're finding matches and ids*/var nameToFind:String = "Aynsley Dunbar";

var textBoxRef:TextBox;var listViewRef:ListView;var selectedNameIndex = bind listViewRef.selectedIndex on replace {  def selectedId = freebaseSearchResult.result[selectedNameIndex].id;  if (selectedId != "") {    println("selectedId:{selectedId}");    nameToFind = freebaseSearchResult.result[selectedNameIndex].name;    obtainGroupsForArtist(selectedId);  }};

/*** Hover text that contains the name of the artist or group*/var nameHoverText:String;

/*** A reference to the HTTP request, for the purpose of monitoring progress*/var req:HttpRequest;

/*** The root class that will hold the object graph from the JSON results*/var freebaseResult:FreebaseResult;

/*** The root class that will hold the object graph from the JSON results*/var freebaseSearchResult:FreebaseSearchResult;

/*** The base URL for the freebase query*/def freebaseURL = "http://www.freebase.com/api/service/mqlread?";

/*** The base URL for a freebase search request*/def freebaseSearchURL = "http://www.freebase.com/api/service/search?";

/*** The base URL to get a freebase image*/def freebaseImageURL = "http://img.freebase.com/api/trans/image_thumb";

var artistsNode:Node;

/*** Fade in transition for artists*/def shelfFadeIn = FadeTransition {  node: bind artistsNode  duration: 1500ms  fromValue: 0.2  toValue: 1.0}

/*** Indexe into groups list*/var groupOneIndex:Integer on replace {  shelfFadeIn.playFromStart();

  // Choose the middle one  def numArtists:Integer = sizeof freebaseResult.result.                          musicGroupMemberMembership[groupOneIndex].                          group.musicMusicalGroupMember;  artistTwoIndex = if (numArtists &gt; 1) numArtists / 2 else 0;

  groupOneName = freebaseResult.result.                 musicGroupMemberMembership[groupOneIndex].group.name;};

/*** Name of the currently selected band*/var groupOneName:String;

/*** Index into artists list*/var artistTwoIndex:Integer;

/*** Create a search query and invoke the JSON handler*/function obtainIdForArtistPartialName(artistPartialName:String) {  listViewRef.visible = true;  nameToFind = artistPartialName;  def partialName = artistPartialName.replace(" ", "+");  var searchUrl = "{freebaseSearchURL}prefix={partialName}&amp;type=/music/artist&amp;limit=10&amp;mql_output=[\{\"id\":null,\"name\":null\}]";

  println("searchUrl:{searchUrl}");  var albumHandler:JSONHandler = JSONHandler {    rootClass: "javafxpert.FreebaseSearchResult"    onDone: function(obj, isSequence): Void {      freebaseSearchResult = obj as FreebaseSearchResult;      println("# of search results:{sizeof freebaseSearchResult.result},freebaseSearchResult:{freebaseSearchResult.code}");      req.stop();    }  };  req = HttpRequest {    location: searchUrl    onInput: function(is: java.io.InputStream) {      albumHandler.parse(is);    }  };  req.start();}

/*** Create the Freebase query and invoke the JSON handler*/function obtainGroupsForArtist(artistFreebaseId:String) {  listViewRef.visible = false;  artistToSearch = artistFreebaseId;  var queryUrl = "{freebaseURL}query=\{\"query\":"    " \{ "    "   \"/common/topic/image\": [\{ "    "     \"id\": null "    "   \}], "    "   \"/music/group_member/membership\": [\{ "    "     \"group\": \{ "    "       \"name\": null, "    "       \"id\":   null, "    "       \"/common/topic/image\": [\{ "    "         \"id\": null "    "       \}], "    "       \"/music/musical_group/member\": [\{ "    "         \"member\": \{ "    "           \"name\": null, "    "           \"id\":   null, "    "           \"/common/topic/image\": [\{ "    "             \"id\": null "    "           \}] "    "         \} "    "       \}] "    "     \} "    "   \}], "    "   \"id\":   \"{artistFreebaseId}\", "    "   \"name\": null, "    "   \"type\": \"/music/artist\" "    " \} \}";

  println("queryUrl:{queryUrl}");  var albumHandler:JSONHandler = JSONHandler {    rootClass: "javafxpert.FreebaseResult"    onDone: function(obj, isSequence): Void {      freebaseResult = obj as FreebaseResult;      println("# of bands:{sizeof freebaseResult.result.musicGroupMemberMembership}");      req.stop();

      // Choose the middle one      def numGroups:Integer = sizeof freebaseResult.result.musicGroupMemberMembership;      groupOneIndex = if (numGroups &gt; 1) numGroups / 2 else 0;    }  };  req = HttpRequest {    location: queryUrl    onInput: function(is: java.io.InputStream) {      albumHandler.parse(is);    }  };  req.start();}var sceneRef:Scene;

Stage {  title: bind "BandmatesFX - {nameToFind}"  scene: sceneRef = Scene {    width: 1000    height: 700    content: [      ImageView {        image: Image {          url: "http://www.popsci.com/files/imagecache/article_image_large/files/articles/guitar.gif"        }        fitWidth: bind sceneRef.width        preserveRatio: true        opacity: 0.1      },      VBox {        nodeHPos: HPos.CENTER        layoutY: 10        spacing: 10        content: [          HBox {            spacing: 10            content: [              ImageView {                image: bind Image {                  url: "{freebaseImageURL}{artistToSearch}?maxheight={IMAGE_HEIGHT}"                }              },              VBox {                content: [                  textBoxRef = TextBox {                    promptText: "Enter artist name"                    text: bind nameToFind with inverse                    columns: 20                    font: Font.font(null, 14)                    action:function():Void {                      if (nameToFind != "" and (req.percentDone == 0.0 or req.percentDone == 100.0)) {                        obtainIdForArtistPartialName(nameToFind);                      }                    }                    onKeyTyped:function(ke:KeyEvent) {                      println("req.percentDone:{req.percentDone}");                      if (textBoxRef.rawText != "" and (req.percentDone == 0.0 or req.percentDone == 100.0)) {                        obtainIdForArtistPartialName(textBoxRef.rawText);                      }                    }                  },                  listViewRef = ListView {                    visible: false                    height: 100                    items: bind for (rslt in freebaseSearchResult.result) {                      rslt.name                    }                    layoutInfo: LayoutInfo {                      width: bind textBoxRef.width - 10                      height: 80                    }                  }                ]              },              ProgressIndicator {                progress: bind req.progress              },              Label {                text: bind nameHoverText                font: Font.font(null, FontWeight.BOLD, 18)              }            ]          },          TitledBorder {            text: bind "{nameToFind} played in these groups:"            font: Font.font(null, FontWeight.BOLD, 14)            lineColor: Color.GREY            node: Shelf {              reflection: false              showScrollBar: false              showText: true              imageUrls: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {                "{freebaseImageURL}{grp.group.id}?maxheight={IMAGE_HEIGHT}"              }              imageNames: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {                grp.group.name;              }              index: bind groupOneIndex with inverse              thumbnailWidth: IMAGE_HEIGHT              thumbnailHeight: IMAGE_HEIGHT              layoutInfo: LayoutInfo {                width: bind sceneRef.width                height: IMAGE_HEIGHT + 120              }            }          },          artistsNode = Panel {            content: bind for (grp in freebaseResult.result.musicGroupMemberMembership) {              TitledBorder {                text: bind "{groupOneName} has had the following members:"                font: Font.font(null, FontWeight.BOLD, 14)                lineColor: Color.GREY                node: Shelf {                  visible: bind indexof grp == groupOneIndex                  reflection: false                  showScrollBar: false                  showText: true                  imageUrls: bind for (mmbr in freebaseResult.result.                                           musicGroupMemberMembership[indexof grp].                                           group.musicMusicalGroupMember) {                    "{freebaseImageURL}{mmbr.member.id}?maxheight={IMAGE_HEIGHT}"                  }                  imageNames: bind for (mmbr in freebaseResult.result.                                           musicGroupMemberMembership[indexof grp].                                           group.musicMusicalGroupMember) {                    mmbr.member.name                  }                  onCenterImagePressed:function(me:MouseEvent):Void {                    var mmbr = freebaseResult.result.                               musicGroupMemberMembership[indexof grp].                               group.musicMusicalGroupMember[artistTwoIndex];                    nameToFind = mmbr.member.name;                    artistToSearch = mmbr.member.id;                    obtainGroupsForArtist(mmbr.member.id);                  }                  index: bind artistTwoIndex with inverse                  thumbnailWidth: IMAGE_HEIGHT                  thumbnailHeight: IMAGE_HEIGHT                  layoutInfo: LayoutInfo {                    width: bind sceneRef.width                    height: IMAGE_HEIGHT + 120                  }                }              }            }            layoutInfo: LayoutInfo {              width: bind sceneRef.width              height: IMAGE_HEIGHT + 120            }          }        ]      }    ]  }}obtainGroupsForArtist(artistToSearch);</pre>
<p>To try out this application, click the Web Start link below.  Since this application is a work in progress, I&#8217;ll give you a couple of pointers:</p>
<ul>
<li>When typing the name of an artist in the text box, each key invokes a web service, so wait until the progress indicator is solid before typing the final character (I&#8217;ll make this smoother in a future iteration).</li>
<li>Not all artists are in groups, and I&#8217;m not doing the necessary exception handling yet to catch this in the response from Freebase.  I know that many artists such as Eric Clapton, Bob Dylan, and Steve Winwood work, as well as any artist that you can click in the bottom cover flow (by definition they are members of a group).</li>
</ul>
<p>  <a href="http://jmentor.com/JavaFX_1-2/BandmatesFXnext/BandmatesFX.jnlp"><img alt="Webstartsmall2" src="http://learnjavafx.typepad.com/weblog/images/2008/07/23/webstartsmall2.gif" title="Webstartsmall2" border="0" height="34" width="88" /></a>  </p>
<p>For more background on this application, see the <a href="http://learnjavafx.typepad.com/weblog/2009/07/leveraging-jfxtras-and-freebase-with-javafx-to-create-bandmatesfx.html" target="_blank">previous article</a> in this series.  As always, please leave a comment if you have any questions.  Also, if you have any suggestions for future enhancements, please leave a comment as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/205/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/205/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/205/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=205&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/freebase-contributing-artists-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401157138ebbd970c-800wi" medium="image">
			<media:title type="html">BandmatesFX_Aynsley_small</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/07/23/webstartsmall2.gif" medium="image">
			<media:title type="html">Webstartsmall2</media:title>
		</media:content>
	</item>
		<item>
		<title>Educational JavaFX Script Apps</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/educational-javafx-script-apps/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/educational-javafx-script-apps/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:42:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/educational-javafx-script-apps/</guid>
		<description><![CDATA[JavaFX in the Wild: Sapphire! With JavaFX 1.0 having been released just a few days ago, I&#8217;m pleased that we&#8217;re observing more JavaFX applications &#8220;in the wild&#8221;. Here&#8217;s one that I became aware of recently, named Sapphire, developed by The Standards Company. According to the website in which you can launch this JavaFX application: &#8220;Sapphire [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=204&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/12/javafx-in-the-wild-sapphire-ce.html">JavaFX in the Wild: Sapphire!</a></h3>
<p><a href="http://www.informator.se/Product.aspx?ArticleNr=T2879" style="display:inline;"><img alt="Stockholm-09-Horizontal" class="at-xid-6a00e54f133d698834010536a3ba7d970c image-full " src="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" title="Stockholm-09-Horizontal" border="0" /></a>  </p>
<p>With JavaFX 1.0 having been released just a few days ago, I&#8217;m pleased that we&#8217;re observing more JavaFX applications &#8220;in the wild&#8221;.  Here&#8217;s one that I became aware of recently, named Sapphire, developed by <a href="http://www.standardsco.com/">The Standards Company</a>.  </p>
<p><a href="http://sapphire.standardsco.com/" style="display:inline;"><img alt="Picture 1" class="at-xid-6a00e54f133d698834010536799bcb970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536799bcb970b-800wi" title="Picture 1" border="0" /></a>  </p>
<p>According to the <a href="http://sapphire.standardsco.com/">website in which you can launch this JavaFX application</a>:</p>
<p><strong><em>&#8220;Sapphire is an advanced classroom observation tool. It provides an easy-to-use interface, multiple platform deployments,  and interchangeable observation forms which can be customized to fit most any  situation. The Community Edition [which is the version that you can try out from the link above] is a demonstration  version requested by the Oklahoma State Department of Education and configured to  complement the &#8220;Time on Task&#8221; observation form released in October 2008.</em></strong>&#8220;</p>
<p><strong>Some JavaFX Technical Notes from Ben Jones of The Standards Company: Real-time Charting in JavaFX</strong></p>
<p>One of the features of JavaFX that makes it attractive to real-time application developers is its ability to tie graphical elements to models through the binding mechanism. This mechanism makes it possible for the current state of the model to be reflected in the interface without the need to create any type of polling system.</p>
<p>In our Sapphire application, we collect real-time data from classroom observations. The observer records classroom events by pressing various buttons. These events are displayed in several dashboard type displays which are actively tied to supporting models. One of these displays in a time lime of events created by a series of colored rectangles. The size, placement and color of the rectangles represent different relationships in the event data. Every time an event is pressed, the data changes and the bound display automatically updates.</p>
<p>To achieve this, you only need three things: a data model, a display element, and an event driver of some type. Let&#8217;s take a look at one of the visual building blocks, the <strong>TimeOnTaskBlock </strong>class:</p>
<pre>public class TimeOnTaskBlock extends CustomNode {

public var aboveColor:Color = Color.GREEN;public var belowColor:Color = Color.RED;

public var seconds:Integer;public var startingMark:Integer;public var zoneWidth:Integer = 600;public var zoneSeconds:Integer = 3600;public var height:Integer = 100;public var maxSegments:Number = 5;public var segment:Number = 0;public var x:Integer;public var scale:Number = 0.95;

  public override function create(): Node {    return Group {

      var maxDisplayHeight:Number = height/2;

      content: [        Rectangle {          x: bind zoneWidth * startingMark / zoneSeconds;          y: bind height/2 - scale * ((maxDisplayHeight) * segment/maxSegments)          width: bind zoneWidth * seconds / zoneSeconds;          height: bind scale * (maxDisplayHeight * segment/maxSegments)          fill: bind aboveColor          strokeWidth:0        },        Rectangle {          x: bind zoneWidth * startingMark / zoneSeconds;          y: bind height / 2          width: bind zoneWidth * seconds / zoneSeconds;          height: bind scale * (maxDisplayHeight - (maxDisplayHeight * segment/maxSegments))          fill: bind belowColor          strokeWidth:0        }      ]      effect: Lighting {        light: DistantLight { azimuth: 225 elevation: 60 }        surfaceScale: 2      }    };  }}</pre>
<p>This custom node represents what will be displayed. It is a pair of scaled rectangles stacked on top of each other. The various attributes define shape, size, and placement. Notice the use of the the <strong>DistantLight </strong>effect to give the rectangles in the graph some depth. The next building block up from this is another custom node that handles the visual orchestration of the time blocks nodes. The <strong>DisplayTimeChart </strong>node is effectively the dashboard element being displayed. It has a data member holding a sequence of <strong>TimeOnTaskBlock </strong>nodes. Let&#8217;s take a peek at this node:</p>
<pre>public class TimeDisplayChart extends CustomNode {

  public var width:Integer;  public var height:Integer;  public var zoneSeconds:Integer;  public var zoneWidth:Integer;  public var background:Color;  public var timer:SapphireClock;  public var timeMark:Integer = 0;  public var currentSegment:Number = 0;  public var displayTicker:Integer;  public var displayBlocks:TimeOnTaskBlock[];  public var onColor:Color = Color.#96ff96;  public var offColor:Color = Color.#ff9696;

  public override function create(): Node {    return Group {      content: [        Group {          content:[            Rectangle {              width: width              height: height              fill: background              arcWidth:10              arcHeight:10              stroke:Color.WHITE            },            Group {              translateX:2              content:[                Group {                  content: bind displayBlocks                }              ]            },            Group {              translateX:0                content:[                  TimeOnTaskBlock {                    aboveColor:bind onColor                    belowColor:bind offColor                    seconds: bind timer.ticker - timeMark                    startingMark: bind timeMark                    segment:bind currentSegment                  }                ]            },            Line {              startX:0              startY: height / 2              endX: zoneWidth              endY: height / 2              strokeWidth: 1              stroke: Color.BLACK            },            Group {              content: bind                for (i in [1..zoneSeconds - 2] where (i mod 300 == 0)) {                  Line {                    startX: bind zoneWidth * i / zoneSeconds                    startY:0                    endX: bind zoneWidth * i / zoneSeconds                    endY: bind height                    strokeWidth: 1                    stroke: Color.BLACK                  }                }            }          ]          clip: Rectangle {            x:-1,            y:-1            width: bind width + 4            height: bind height + 4          }        },        Group {          translateX: 0          translateY: bind height + 5          content: bind          for (i in [1..zoneSeconds] where (i mod 300 == 0)) {            Text {              textAlignment: TextAlignment.RIGHT              textOrigin: TextOrigin.TOP              fill:Color.WHITE              font: Font {                size: 12              }              x: (zoneWidth * i / zoneSeconds) - 7              content: "{i / 60}"            }          }        }      ]    };  }}</pre>
<p>The <strong>TimeDisplayChart </strong>serves a couple of purposes. First it builds the overall dashboard element. This defines the usual display space, necessary labeling and element placements. Please note two aspects of this class: the group where its content is bound to the <strong>displayBlocks </strong>sequence and the second group composed of a solo <strong>TimeOnTaskBlock</strong>. By binding the content of a group to a data source, any changes in the data source will be made available to the group automatically. This effectively produces a self-updating display since we bound a displayable node. The second group which is a single instance of the <strong>TimeOnTaskBlock </strong>serves another purpose. It covers the span of time since the last data change and the current time. Since the data model stores only past events, we need a means of showing data yet to be stored. It&#8217;s real-time after all.</p>
<p>To place all of this into an application, an instance of <strong>TimeDisplayChart </strong>is placed into a group as follows:</p>
<pre>Group {  translateY:310  translateX:10  content:[    TimeDisplayChart{      width:600      height:100      zoneSeconds:3600      zoneWidth:600      background:Color.#969696      timer: bind timer      displayTicker: bind displayTicker      currentSegment: bind appState.currentSegment      timeMark: bind appState.currentTimeMark      onColor: bind appState.onColor      offColor:bind appState.offColor      displayBlocks: bind displayblocks    }  ]}</pre>
<p>Here we can see the various attributes of the custom node being bound to different data sources and conditions that exit within the larger context of the application. The bindings create an active communication channel between application state data and the graphical elements. It&#8217;s convenient, responsive, and easy to manage during the development process.</p>
<p><strong>JavaFX in the Enterprise</strong></p>
<p>The technical notes that Ben Jones supplied above demonstrate that graphing real-time data is very achievable in JavaFX.  This is one of the capabilities required by many enterprise applications, so I&#8217;d like to see an open source initiative that provides a library of JavaFX graphs (that have a contemporary RIA look and feel, of course).</p>
<p>Anyway, <a href="http://sapphire.standardsco.com/">play with Sapphire</a>, and please give The Standards Company your feedback on this very specialized JavaFX application.  Also, if you have any JavaFX applications in the wild, please let me know at jim.weaver [at] javafxpert.com.  At the moment I&#8217;m particularly interested in showcasing JavaFX apps that communicate with a server, such as enterprise applications and mashups.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=204&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/educational-javafx-script-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" medium="image">
			<media:title type="html">Stockholm-09-Horizontal</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536799bcb970b-800wi" medium="image">
			<media:title type="html">Picture 1</media:title>
		</media:content>
	</item>
		<item>
		<title>Compiled JavaFX Script Tools</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/compiled-javafx-script-tools/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/compiled-javafx-script-tools/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:34:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/compiled-javafx-script-tools/</guid>
		<description><![CDATA[JavaFX Authoring Tool Demo at JavaOne At JavaOne 2009 during James Gosling&#8217;s Toy Show, Tor Norbye demonstrated the current state of the long-awaited JavaFX Authoring Tool. Some of the demonstrated features were: The ability to position/orient a node (e.g. an image) in multiple places on the stage, each corresponding with a point in time on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=203&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_general entry-author-jim_weaver entry-type-post entry" id="entry-67937821">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/06/javafx-authoring-tool-demo-at-javaone.html">JavaFX Authoring Tool Demo at JavaOne</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>At JavaOne 2009 during James Gosling&#8217;s Toy Show, Tor Norbye demonstrated the current state of the long-awaited JavaFX Authoring Tool.  </p>
<p><a href="http://sellmic.com/blog/2009/06/05/javafx-authoring-tool-demo-at-javaone-2009-with-video/" style="display:inline;" target="_blank"><img alt="JavaFXAuthoringTool" class="at-xid-6a00e54f133d698834011570fc1110970b " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834011570fc1110970b-800wi" title="JavaFXAuthoringTool" border="0" /></a> </p>
<p>Some of the demonstrated features were:</p>
<ul>
<li>The ability to position/orient a node (e.g. an image) in multiple places on the stage, each corresponding with a point in time on a timeline (represented by a slider).  Each point in time becomes a KeyFrame, and interpolations are calculated based upon position/orientation.  Dragging the slider results in seeing the node move and rotate through the positions in which the node was placed.  I assume that scaling and other transforms will be supported in the tool as well.  Tor mentioned that various interpolations are supported (LINEAR, EASEIN, EASEOUT, and EASEBOTH).  I assume that spline interpolation will be supported as well.</li>
<li>Placing UI controls on the stage, hooking them up with event handlers, as well as binding to instance variable values (e.g. in other UI controls).</li>
<li>Targeting an application at multiple screens (e.g. desktop, mobile phones), with the ability to customize for each screen.</li>
</ul>
<p>Augusto Sellhorn (AKA sellmic) has compiled some <a href="http://sellmic.com/blog/2009/06/05/javafx-authoring-tool-demo-at-javaone-2009-with-video/" target="_blank">video clips and his thoughts about the JavaFX Authoring Tool</a> in a blog post.  If you didn&#8217;t see the Toy Show, checking out Augusto&#8217;s post is a quick way of seeing the preview of the tool.</p>
<p>Update June 13, 2009: Augusto created <a href="http://sellmic.com/blog/2009/06/13/new-screenshots-of-the-javafx-design-tool/" target="_blank">another blog post</a> with new screenshots, links and thoughts on the JavaFX Authoring Tool.</p>
<p>   var dzone_url = &#39;http://learnjavafx.typepad.com/weblog/2009/06/javafx-authoring-tool-demo-at-javaone.html&#39;; var dzone_title = &#39;JavaFX Authoring Tool Demo at JavaOne&#39;; var dzone_blurb = &#39;[blurb]&#39;; var dzone_style = &#39;2&#39;; </p></div>
</div>
</div>
<p>
<div class="entry-category-compiled_javafx_script_tools entry-author-jim_weaver entry-type-post entry" id="entry-66694729">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/05/magnus-robertsson-presents-another-aspect-on-javafx-pojo-binding.html">Magnus Robertsson presents another *aspect* on JavaFX MOJO binding <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </a></h3>
<div class="entry-content">
<div class="entry-body">
<p><a href="http://blog.jayway.com/2009/05/12/transparent-bind-of-javafx-and-pojos/" style="float:right;" target="_blank"><img alt="Mojo" class="at-xid-6a00e54f133d69883401156f8c92b7970c " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401156f8c92b7970c-800wi" title="Mojo" border="0" /></a> It is often desirable to have at least part of a JavaFX program&#8217;s model represented by Java objects.  The problem is that JavaFX programs can&#8217;t bind to plain old Java objects (POJOs) yet.  Some workarounds have been suggested, <a href="http://blog.jayway.com/2009/05/12/transparent-bind-of-javafx-and-pojos/" target="_blank">one of them articulated by Magnus Robertsson</a> of <a href="http://www.jayway.com/" target="_blank"><em>jayway</em></a>.</p>
<p>Magnus has created an open source tool called <strong>javafxbinder </strong>that utilizes Aspect-Oriented Programming, and PropertyChangeListener functions, to keep a JavaFX object updated when mutator functions in a POJO are called.  Nice MOJO, Magnus!</p>
<p><strong>Speaking at Øredev in Malmö, Sweden</strong><strong> </strong></p>
<p><span style="text-decoration:underline;"><a href="http://www.oredev.org/" style="display:inline;" target="_blank"><img alt="Oradev_2009" class="at-xid-6a00e54f133d69883401156f8c8a43970c " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401156f8c8a43970c-800wi" title="Oradev_2009" border="0" /></a> </span> </p>
<p>On a related note, I&#8217;ll be speaking at <a class="mainheader" href="http://www.oredev.org/" target="_blank" title="CSM Course">Øredev</a> (founded by <strong>jayway </strong>and some other &#8220;ways&#8221;: <strong>dotway</strong>, <strong>leadway, </strong><strong>testway</strong> and <strong>realway</strong>) which will be held in Malmö, Sweden on 2-6 November, 2009.  Hope to see you there!</p>
</div>
</div>
</div>
<p>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-category-jfxtras entry-author-jim_weaver entry-type-post entry" id="entry-61819256">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/01/jfxtras-02-released-featuring-extra-shapes-for-javafx.html">JFXtras 0.2 Released: Featuring Extra Shapes for JavaFX</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>The open source JFXtras project provides extra capabilities for JavaFX, such as a powerful Grid layout facility, dialog box capability, easy to use asynchronous thread support and declarative unit testing.  The JFXtras 0.2 release features a new custom shape library that came out of a joint effort with the jSilhouette Project.  See <a href="http://steveonjava.com/2009/01/23/jfxtras-02-release-shapes-shapes-and-more/">Stephen Chin&#8217;s blog post for more information on this release</a>.  Also, see <a href="http://www.jroller.com/aalmiray/entry/jsilhouette_0_3_released">Andres Almiray&#8217;s blog post on the jSilhouette 0.3 release</a>.</p>
<p>Here a screenshot of the ShapesDemoFX program that is included with the JFXtras project.  Click the Java Web Start link below to run the demo.</p>
<p><span style="text-decoration:underline;"><a href="http://jmentor.com/JFXtras/ShapesDemoFX.jnlp" style="display:inline;"><img alt="ShapeDemoFX" src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536e77be7970b-800wi" title="ShapeDemoFX" border="0" /></a>  </span> </p>
<p><a href="http://jmentor.com/JFXtras/ShapesDemoFX.jnlp" style="display:inline;"><img alt="Webstart.small2" class="at-xid-6a00e54f133d6988340105363b0d3f970c " src="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105363b0d3f970c-800wi" title="Webstart.small2" border="0" /></a></p>
<p>Here&#8217;s a screenshot from a little program written by Chris Wright that demonstrates how to use some of the shapes in JFXtras, followed by the source code:</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536e7b9b0970b-pi" style="display:inline;"><img alt="Jfxtras_0-2_prog" class="at-xid-6a00e54f133d698834010536e7b9b0970b " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536e7b9b0970b-800wi" title="Jfxtras_0-2_prog" border="0" /></a>  </p>
<pre>import javafx.scene.*;import javafx.stage.*;import javafx.scene.text.*;import javafx.scene.paint.*;import javafx.scene.layout.*;import javafx.scene.transform.*;import org.jfxtras.scene.shape.*;

Stage { width: 500 height: 350 title: "JFXtras 0.2" scene:   Scene {     fill: Color.BLACK     content: [       Group {         content: [           MultiRoundRectangle {             x: 50             y: 100             width: 400             height: 100             topRightWidth: 35             topRightHeight: 35             bottomRightWidth: 35             bottomRightHeight: 35             fill: LinearGradient {               startX: 0.0               startY: 0.0               endX: 1.0               endY: 0.0               proportional: true               stops: [                 Stop {                   offset: 0.0                   color: Color.rgb(255,255,51)                 },                 Stop {                   offset: 0.5                   color: rgb(255,102,0)                 }               ]             }           },           ReuleauxTriangle {             angle: -48             x: 150             y: 100             width: 175             fill: Color.rgb(204,0,0)             stroke: Color.rgb(102,0,0)           },           HBox {             transforms: Translate.translate(90, 110)             content: [               Text {                 content: "JFX"                 textOrigin: TextOrigin.TOP                 font: Font.font("Sans serif", FontWeight.BOLD, 100)               },               Text {                 transforms: Translate.translate(0, 10)                 content: "tras"                 textOrigin: TextOrigin.TOP                 font: Font.font("Sans serif", FontWeight.BOLD, FontPosture.ITALIC, 70)               }             ]           }         ]       }       HBox {         transforms: Translate.translate(90, 250)         spacing: 7         content: [           Asterisk {             centerX: 10             centerY: 10             radius: 25             width: 4             beams: 7             roundness: 0.5             fill: Color.WHITE           },           Text {             content: "Now With Cool Shapes!"             textOrigin: TextOrigin.TOP             font: Font.font("Sans serif", FontWeight.BOLD, 24)             fill: Color.WHITE           }         ]       }     ]   }}</pre>
<p>For your convenience, here is a link to the <a href="http://jfxtras.googlecode.com/svn/site/javadoc/release-0.2/index.html">JFXtras 0.2 API docs</a>, as well as the <a href="http://code.google.com/p/jfxtras/">JFXtras project</a> itself.</p>
<p>Congratulations to the JFXtras project team for this 0.2 release, particularly Dean Iverson and Andres Almiray, and our fearless leader Stephen Chin <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</div>
</div>
</div>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-category-security entry-author-jim_weaver entry-type-post entry" id="entry-61272792">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/01/absence-of-malice-in-javafx.html">Absence of Malice in JavaFX</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>Because JavaFX Script programs compile to Java CLASS files and run within the Java Runtime Environment (JRE), they are subject to the Java security model.  When a user clicks a Java Web Start link or navigates to a page that contains an applet, the Java code must play exclusively in &#8220;the sandbox&#8221; unless the user gives it permission to jump out.  There are a couple of ways to enable the user to give this permission to the application:</p>
<ol>
<li><strong>Option #1: Don&#8217;t sign the JAR files that contain your JavaFX application. </strong> By not signing the JAR files, you are ensuring that the user will be asked to authorize any out-of-sandbox-experiences.  For example, the <a href="http://learnjavafx.typepad.com/weblog/2008/12/earthrise-at-christmas-1968-an-apollo-8-holiday-wish-echoed-in-javafx.html">Earthrise at Christmas</a> post contains a Java Web Start link to a JavaFX application that isn&#8217;t signed.  Because the application displays an image that is loaded from another website (in this case nasa.gov) the following Security Warning dialog is presented to the user:</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2ce47970b-pi" style="display:inline;"><img alt="Security-warning-dialog" class="at-xid-6a00e54f133d698834010536c2ce47970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2ce47970b-800wi" title="Security-warning-dialog" border="0" /></a></p>
<p>This option makes the user respond to Security Warnings, but if the code isn&#8217;t signed, then the user shouldn&#8217;t be expected to trust the application without receiving these kinds of warnings.</li>
<li><strong>Option #2: Sign the JAR files that contain your JavaFX application.</strong>  By signing the JAR files, you are ensuring that the application will not execute unless the user indicates that he/she trusts the signer of the code.  In addition, the user won&#8217;t be asked for permission for the application to play outside of the sandbox when, for example, the image from Nasa above is accessed, or a file is written.  To demonstrate this, if you click the following Java Web Start link to the Earthrise at Christmas application in which the JAR file is signed, you&#8217;ll be presented with the Security dialog shown below it:
<p><a href="http://jmentor.com/ProJavaFX/HelloEarthRiseSigned/HelloEarthRise.jnlp" style="display:inline;"><img alt="Webstart.small2" class="at-xid-6a00e54f133d698834010536cc82c8970c " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536cc82c8970c-800wi" title="Webstart.small2" border="0" /></a></p>
<p><span style="text-decoration:underline;"><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2d96a970b-pi" style="display:inline;"><img alt="Security-warning-dialog-signed" class="at-xid-6a00e54f133d698834010536c2d96a970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2d96a970b-800wi" title="Security-warning-dialog-signed" border="0" /></a></p>
<p></span>Notice that the the dialog says that the signature has been verified/validated (because a code-signing certificate was used).  This is an important feature because if the signature can&#8217;t be verified, then the user can&#8217;t be sure who really signed it.  This opens the door for spoofed and malicious applications.  The only way that I would run an application whose signature hasn&#8217;t been verified, is if I knew by some other means who published the application (e.g. the application was written by a colleague and it is located on a corporate intranet).</li>
</ol>
<p><strong>What about the Self-Signed Jar option in NetBeans (using the JavaFX Plug-in)?</strong></p>
<p>If you select the <strong>Self Signed Jar</strong> option in NetBeans as shown below, then a dialog similar to the one above will appear when the user runs the application, but it will say that the signature can&#8217;t be verified.</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536cc9604970c-pi" style="display:inline;"><img alt="Security-netbeans-self-signed" class="at-xid-6a00e54f133d698834010536cc9604970c image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536cc9604970c-800wi" title="Security-netbeans-self-signed" border="0" /></a>  </p>
<p>For reasons described above, posting or executing Java and JavaFX applications with self-signed JARs on the Internet is not a good practice.  It&#8217;s better to go with option #1 above and let the user approve any out-of-the-sandbox behavior, or option #2 with a code-signing certificate (e.g. from VeriSign or Thawte).</p>
<p><strong>Creating and Signing Pack200 (Compressed) Files</strong></p>
<p>The JAR files that contain Java/JavaFX applications can be further compressed into the Pack200 format and deployed with JNLP.  To create and sign a Pack200 file, use the following commands available with the JDK, shown here in the context of the Earthrise at Christmas application:</p>
<pre>pack200 --repack HelloEarthRise.jar

jarsigner -keystore [keystore url] -verbose -keypass [key password] -storepass [keystore password] HelloEarthRise.jar [keystore alias]

pack200 HelloEarthRise.jar.pack.gz HelloEarthRise.jar</pre>
<p>As always, please leave a comment if you have any questions.</p>
</div>
</div>
</div>
<p>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-category-jfxtras entry-author-jim_weaver entry-type-post entry" id="entry-60679512">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2009/01/javafx-skins-game.html">JavaFX Skins Game, and Happy New Year!</a></h3>
<div class="entry-content">
<div class="entry-body">
<p><a style="display:inline;" href="http://www.informator.se/Product.aspx?ArticleNr=T2879"><img class="at-xid-6a00e54f133d698834010536a3ba7d970c image-full " alt="Stockholm-09-Horizontal" title="Stockholm-09-Horizontal" src="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" border="0" /></a>  </p>
<p><strong>A Note from Jim Weaver:</strong></p>
<p><strong><em>First of all, I would like to wish you a Happy and Blessed New Year!  I&#8217;m excited about the momentum that JavaFX has achieved since its 1.0 release in December 2008, and about its increased adoption for RIA and mobile development in 2009.</em></strong></p>
<p><strong><em>Also, I&#8217;d like to introduce Dean Iverson, the author of today&#8217;s article, who for many of you needs no introduction because he&#8217;s been active in the Java/Swing/JavaFX community for some time now.  Dean will be a regular contributor to the JavaFXpert blog, as well as to the JFXtras project that he mentions in todays article.<br /></em></strong></p>
<p style="text-align:left;"><strong><em>Dean has been writing software professionally for over 15 years.  In that time he has worked on everything from games, to driving simulators, to large-scale enterprise applications and just about everything in between.  Currently, he is employed by the Virginia Tech Transportation Institute where he has a cool job (of which I&#8217;m jealous) as a senior researcher where he is working on rich client applications.  He also has a small software consultancy called <a href="http://www.pleasingsoftware.com/">Pleasing Software Solutions</a> which he co-founded along with his wife who, by his own admission, is the brains of the outfit and the better programmer.  I personally think that his wife develops these JavaFX examples and that he just writes about them <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   Also, he is the Technical Reviewer of the upcoming Pro JavaFX book that Weiqi Gao, Stephen Chin and I are currently writing.  With that being said, please enjoy Dean&#8217;s first post on the JavaFXpert blog:</em></strong></p>
<p style="text-align:left;font-family:Trebuchet MS;">
<h2><span style="font-family:Trebuchet MS;font-size:23px;">JavaFX Skins Game</span><br /></h2>
<p style="text-align:left;font-family:Trebuchet MS;">
<p>Simon Morris, author of the upcoming <em><strong>JavaFX in Action</strong></em> book, has just written a very informative  <a href="http://weblogs.java.net/blog/javakiddy/archive/2008/12/javafx_in_style.html" target="_blank">post</a>  on his blog. He shows how to create a custom progress bar that is skinnable using JavaFX&#8217;s support  for CSS. It&#8217;s definitely worth a read. Using CSS you can customize just about every aspect of the rectangles  that Simon uses in his progress meter: their size, color, even how many there are! It&#8217;s the ultimate in  flexibility.  </p>
<h2>A New Shape</h2>
<p>  But what if you want to use a different shape entirely? Even that is possible without having to recompile  Simon&#8217;s original code. For example, there is a new shape in the  <a href="http://code.google.com/p/jfxtras/" target="_blank">JFXtras project</a>  called the VariableCornerRectangle. This shape is a rectangle that can have any combination of rounded or  square corners. It looks like this:  </p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a15a3c970b-pi" style="display:inline;"><img alt="Picture1" class="at-xid-6a00e54f133d698834010536a15a3c970b " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a15a3c970b-800wi" title="Picture1" border="0" /></a><br />The code to produce the shape above looks like this:    </p>
<pre>VariableCornerRectangle { ulArc: 80 urArc: 0 lrArc: 80 llArc: 0 width: 200 height: 200 fill: Color.CORNFLOWERBLUE stroke: Color.BLUE strokeWidth: 5}</pre>
<p>  We just use the shape&#8217;s corner arc attributes to set the upper-left and lower-right corners as arcs with a  radius of 80 pixels. We then set the other corners to be square by using an arc size of 0.  </p>
<h2>A New Skin</h2>
<p>  So how do we use this new shape in Simon&#8217;s progress meter? First, we create a new skin class. It will  be almost exactly the same as Simon&#8217;s, but it will use the new shape.  </p>
<pre>public class VariableCornerProgressSkin extends Skin { public var boxCount:Integer = 10; public var boxWidth:Number = 15; public var boxHeight:Number = 20; public var boxHGap:Number = 2; public var unsetHighColor:Color = Color.YELLOW; public var unsetMidColor:Color = Color.GREEN; public var unsetLowColor:Color = Color.DARKGREEN; public var setHighColor:Color = Color.ORANGE; public var setMidColor:Color = Color.RED; public var setLowColor:Color = Color.DARKRED;

 var boxValue:Integer = bind {   var p:Progress = control as Progress;   var v:Number = (p.value - p.minimum) / (p.maximum - p.minimum);   (boxCount * v) as Integer; }

 init {   def border:Number = bind boxWidth / 10;   def arc:Number = bind boxWidth / 2;   def lgUnset:LinearGradient = bind makeLG(unsetHighColor,unsetMidColor,unsetLowColor);   def lgSet:LinearGradient = bind makeLG(setHighColor,setMidColor,setLowColor);

   scene = HBox {     spacing: bind boxHGap;     content: bind for(i in [0..</pre>
<h2>A Small Change Of Style</h2>
<p>  Simon&#8217;s original code used the following CSS to style the three different progress meters in his sample  program.  </p>
<pre>"Progress" { boxWidth: 15; boxHGap: 2;

 setHighColor: yellow; setMidColor: red; setLowColor: darkred;

 unsetHighColor: cyan; unsetMidColor: blue; unsetLowColor: darkblue;}

"Progress"#testId { boxWidth: 25; boxHeight: 30; boxCount: 7; boxHGap: 1;

 unsetHighColor: white; unsetMidColor: silver; unsetLowColor: dimgray;}

"Progress".testClass { boxWidth: 7; boxHGap: 2; boxCount: 20;

 setHighColor: yellow; setMidColor: limegreen; setLowColor: darkgreen;}</pre>
<p>  This stylesheet produced the three progress meters in Simon&#8217;s original example.  </p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a16007970b-pi" style="display:inline;"><img alt="Picture2" class="at-xid-6a00e54f133d698834010536a16007970b " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a16007970b-800wi" title="Picture2" border="0" /></a>  </p>
<p>All we have to do to use our new skin is to add a new CSS selector. In this case I want to change  the skin of the progress meter with the id of <code>testId</code>. So I&#8217;ll add a new selector just  above the existing one that applies the new skin.  </p>
<pre>"Progress"#testId { skin: javafx_css.VariableCornerProgressSkin;}

"Progress"#testId { boxWidth: 25; boxHeight: 30; boxCount: 7; boxHGap: 1;

 unsetHighColor: white; unsetMidColor: silver; unsetLowColor: dimgray;}</pre>
<p>  And voila, we have a new progress meter! Notice that the middle meter (whose id is <code>testId</code>)  is the only one that changed. Click the Java Web Start Launch icon below to see it in action.</p>
<p><a href="http://www.jmentor.com/JavaFX_1-0/JavaFX_CSS/JavaFX_CSS.jnlp" style="display:inline;"><img alt="Picture3" class="at-xid-6a00e54f133d698834010536a161e2970b " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a161e2970b-800wi" title="Picture3" border="0" /></a>  </p>
<p><a href="http://www.jmentor.com/JavaFX_1-0/JavaFX_CSS/JavaFX_CSS.jnlp" style="display:inline;"><img alt="Webstart.small2" class="at-xid-6a00e54f133d698834010536aa5f9e970c " src="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536aa5f9e970c-800wi" title="Webstart.small2" border="0" /></a>  </p>
<p>I have used the fully qualified path name for the VariableCornerProgressSkin class in the selector&#8217;s  <code>skin</code> declaration. In this case, the class is located in my javafx_css package.  </p>
<p>It is important that the selector with the <code>skin:</code> declaration be a separate selector and be  placed above any other selectors that match the same control. Otherwise all of the style declarations  will be applied to the original skin instead of the new one. Apparently the skin is only replaced after  the entire selector is parsed so any styles contained within the same selector will be applied to the  existing skin rather than the new one.</p>
<p>Thanks again to Simon Morris for the original example!</p>
</div>
</div>
</div>
<p>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-author-jim_weaver entry-type-post entry" id="entry-60557210">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/12/jfxtras-01-release-utilities-and-addons-for-the-javafx-language.html">JFXtras 0.1 Release: Utilities and Add-ons for the JavaFX Language</a></h3>
<div class="entry-content">
<div class="entry-body">
<p><a style="display:inline;" href="http://www.informator.se/Product.aspx?ArticleNr=T2879"><img class="at-xid-6a00e54f133d698834010536a3ba7d970c image-full " alt="Stockholm-09-Horizontal" title="Stockholm-09-Horizontal" src="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" border="0" /></a>  </p>
<p><a href="http://code.google.com/p/jfxtras/">JFXtras is an open-source project that helps fill in some of the gaps</a> of the JavaFX 1.0 Release. The JFXtras project is led by Stephen Chin (co-author of the upcoming Pro JavaFX book) and it includes support for Dialogs, Grid Layouts, Unit Testing, and an Asynchronous Worker class. </p>
<p><a href="http://code.google.com/p/jfxtras/" style="display:inline;"><img alt="JFXtras-Grid" class="at-xid-6a00e54f133d6988340105369ae568970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105369ae568970b-800wi" title="JFXtras-Grid" border="0" /></a>  </p>
<p>You can download the 0.1 release, peruse the Javadoc online, and sign-up for the mailing list, all on <a href="http://code.google.com/p/jfxtras/">the Google Code project site</a>.</p>
<p>The 0.1 release includes the following capabilities that augment what JavaFX 1.0 provides: </p>
<ul>
<li>Dialogs &#8211; The JFXtra Dialog provides a drop-in replacement for a Stage that will pop-up a real Java Dialog. This includes support for an owner window, modality, alwaysOnTop, the ability to hide the taskbar icon, and many other features. </li>
<li>Layouts &#8211; The JFXtra Grid provides an advanced layout container (example shown above) that can be used for JavaFX nodes and wrapped swing components. </li>
<li>Testing &#8211; JFXtras provides a declarative Unit Testing facility that allows you to do write JavaFX tests in the JavaFX language. It is modeled after best-of-class behavior-driven and fluent testing patterns to make tests easier to read and maintain. </li>
<li>Asynchronous Worker &#8211; Working on the theory that developers deserve their share of rope, JFXtras provides an asynchronous worker wrapper that allows you to execute pure JavaFX code on a background thread. </li>
</ul>
<p></div>
</div>
</div>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-author-jim_weaver entry-type-post entry" id="entry-60184248">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/12/a-javafx-visual-designer-tool-just-fell-out-of-the-sky.html">A JavaFX Visual Designer Tool Just Fell out of the Sky</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>Jeff Martin of <a href="http://reportmill.com/">ReportMill Software</a> has been involved with the JavaFX community since the beginning.  ReportMill has been working on a GUI builder tool for JavaFX named JFXBuilder, and has given the community a peek from time to time.  Each time, I&#8217;ve kicked the tires a bit, but haven&#8217;t felt that it was ready for prime time.</p>
<p>Today on a JavaFX community mailing list, I received the following email from Jeff that began with:</p>
<p><em><strong>&#8220;Hope nobody minds me posting this, since it&#8217;s free and &#8220;educational&#8221;. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </strong></em></p>
<div><em><strong>-jeff&#8221;</strong></em></p>
<p>It was followed by the first portion of the <a href="http://www.reportmill.com/news/2008_12.html">JFXBuilder press release</a>, which contains a Java Web Start link to JFXBuilder, and information such as the following:</p>
<p><span style="font-family:Georgia,Times,Times New Roman;font-size:85%;">&#8220;JFXBuilder is a desktop design and composition   application for visually building JavaFX applications quickly, including   the ability to:</span>
<ul>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Perform  drawing and illustration</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Add   and edit rich text (fonts, colors, styles, wrapping, spelling,   etc.)</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply  advanced fills (textures and gradients)</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply   advanced effects (shadow, reflection, emboss, glow, etc.)</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply   advanced transforms (rotation, scale, skew)</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Drag   and Drop images and other media</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Drag   and Drop application components</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply   Key-Frame based animation</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply   path-based animation</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Apply   Input-related behavior (Mouse-over, Mouse-down, etc.)</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Attach  to a database or XML and perform data binding</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Design   simple layouts for default JavaFX mobile devices</span></li>
<li><span style="font-family:Georgia,Times New Roman,Times,serif;font-size:85%;">Generate   JavaFX code on the fly&#8221;</span></li>
</ul>
<p> I decided to play with it a bit today, and was very impressed with its features. I&#8217;m excited about evaluating its ability to help build JavaFX applications, and would invite you to do the same.  Here&#8217;s a screenshot of the tool at the point that it really started getting my attention, especially after the comment I made yesterday about <a href="http://learnjavafx.typepad.com/weblog/2008/12/javafx-in-the-wild-sapphire-ce.html">desiring a library of JavaFX graphs</a>:</p>
<p><a href="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105367e8a5f970b-pi" style="display:inline;"><img alt="JFXBuilder_ss" class="at-xid-6a00e54f133d6988340105367e8a5f970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105367e8a5f970b-800wi" title="JFXBuilder_ss" border="0" /></a></p>
<p>As I dragged the mouse on the trackball shown above in the lower-right corner, the perspective of the 3D bar graph changed accordingly.  I was not expecting that level of sophistication, given that JavaFX SDK 1.0 was released only two weeks ago.</p>
<p>I haven&#8217;t experimented much with JFXBuilder, and I don&#8217;t know anything about their licensing-related plans yet, but wanted to give you a heads-up that this looks seriously cool to me so far.</p>
<p>Jeff Martin or someone from ReportMill: If you read this, would you leaving a comment and/or link about your licensing-related plans for JFXBuilder?</div>
</div>
</div>
<p></div>
<h2 class="date-header">December 11, 2008</h2>
<div class="entry-category-compiled_javafx_script_tools entry-category-javafx_sdk_10 entry-author-jim_weaver entry-type-post entry" id="entry-59867454">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/12/early-release-of-an-eclipse-plugin-for-javafx-available-from-sun.html">Eclipse Plugin for JavaFX Available, and NetBeans JavaFX Plugin Works on Linux</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>According to Josh Marinacci of Sun on a Java Posse thread: <em><strong>&#8220;We (Sun) have an <a href="http://kenai.com/projects/eplugin">early release of an Eclipse plugin for JavaFX</a> up on Kenai.&#8221;</p>
<p></strong></em><a href="http://kenai.com/projects/eplugin" style="display:inline;"><img alt="Eclipse_plugin" class="at-xid-6a00e54f133d6988340105365389a1970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105365389a1970b-800wi" title="Eclipse_plugin" border="0" /></a>  </p>
<p>Please join me in checking it out and let me know what your experiences are with this early release Eclipse plugin for JavaFX!</p>
<p>On a related note, Weiqi Gao shows us <a href="http://www.weiqigao.com/blog/2008/12/11/javafx_1_0_on_linux_netbeans_plugin.html">how to make the JavaFX 1.0 plugin for NetBeans 6.5 work on Linux</a>!</p>
</div>
</div>
</div>
<p>
<div class="entry-category-compiled_javafx_script_tools entry-category-jfx entry-author-jim_weaver entry-type-post entry" id="entry-56782979">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/11/up-the-nile-with-a-paddle.html">Up the Nile *with* a Paddle: Fun with JavaFX Graphics</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>I&#8217;ve often mentioned the importance of programmers and graphics designers working together to create great looking RIAs.  The declarative syntax of JavaFX facilitates this approach, and the &#8220;Project Nile&#8221; tool available with the JavaFX SDK makes this even easier.</p>
<p><span style="text-decoration:underline;"><a href="http://blogs.citytechinc.com/sanderson/?p=25" style="display:inline;"><img alt="Sten_breakout" class="at-xid-6a00e54f133d69883401053619b9cd970b image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401053619b9cd970b-800wi" title="Sten_breakout" border="0" /></a>  </span> </p>
<p>Try your hand at the <a href="http://blogs.citytechinc.com/sanderson/?p=25">&#8220;Breakout&#8221; style game that Sten posted on his blog</a>, and then <a href="http://blogs.citytechinc.com/sanderson/?p=22">read about how he collaborated with a graphic designer (his four-year-old daughter) to create this game in JavaFX</a>.  Sten discusses in his post how he used Project Nile to export graphics-related JavaFX code from Adobe Illustrator using Project Nile.</p>
<p>On a related note, Silveira Neto (whose <a href="http://learnjavafx.typepad.com/weblog/2008/08/silveira-is-bui.html">JavaFX fun I&#8217;ve featured on this blog before</a>) participated in creating a <a href="http://silveiraneto.net/2008/11/21/inkscape-and-javafx-working-together/">plug-in for Inkscape that exports SVG in the form of JavaFX code</a>.  </p>
<p><a href="http://silveiraneto.net/2008/11/21/inkscape-and-javafx-working-together/" style="display:inline;"><img alt="Inkscape_draw_with" class="at-xid-6a00e54f133d6988340105362281cc970c image-full " src="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105362281cc970c-800wi" title="Inkscape_draw_with" border="0" /></a>  </p>
<p>That Silveira has all the fun!  Regards,</p>
</div>
</div>
</div>
<h2 class="date-header">July 04, 2008</h2>
<div class="entry-category-compiled_javafx_script_tools entry-author-jim_weaver entry-type-post entry" id="entry-52235058">
<h3 class="entry-header"><a href="http://learnjavafx.typepad.com/weblog/2008/07/javafx-api-docu.html">JavaFX API Documentation Tool Now Supports In-line Examples</a></h3>
<div class="entry-content">
<div class="entry-body">
<p>The JavaFX API documentation tool (<strong>javafxdoc</strong>) now supports the effortless insertion of examples.  For instance, this screenshot shows a page of the JavaFX API in which an example is embedded along with its output image generated:</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/07/03/examplesinjavafxdocs.png"><img alt="Examplesinjavafxdocs" title="Examplesinjavafxdocs" src="http://learnjavafx.typepad.com/weblog/images/2008/07/03/examplesinjavafxdocs.png" border="0" height="750" width="584" /></a>   </p>
<p><strong><br />An Explanation from the Author of this Feature</strong></p>
<p>According to an explanation by Josh Marinacci of Sun, <em><strong>&#8220;One of the innovations in the JavaFX toolchain is our new javafxdoc tool. Rather than producing a set of html files like regular &#8216;javadoc&#8217; does, we produce a single large XML file representing the entire codebase&#8217;s API. This lets us easily add extra processing steps, such as producing semantic well-formed XHTML as you see <span class="Object">today</span>.  It also lets us do a few other things. Last time I mentioned custom doclet tags for things like default value and read only.  Now we&#8217;ve added inline examples.</strong></em></p>
<p><em><strong>Before <span class="Object">today</span> if you wanted some example code with a screenshot in your docs you had to mark up the code manually (assuming you wanted any syntax highlighting), then copy the code into a separate project, compile it, run it, then save a screenshot of the running app. Then you must finally copy the screenshot back into your docs. This system is really bad for several reasons: </strong></em></p>
<p><em><strong>* It&#8217;s time consuming, so we do less of it.<br />* The repository becomes polluted with screenshots<br />* The sample code may not compile if the API changes before you release the SDK<br />* The screenshots can get quickly out of date.<br />* The code snippets aren&#8217;t syntax highlighted. </strong></em></p>
<p><em><strong>With our new inline examples system all of these are taken care of. Just use the @example doc tag and the rest will be taken care of for you. The doc tool will compile and run your code into a buffered image. Then it will insert nicely syntax highlighted code back into the final page along with a link to the screenshot.&#8221; </strong></em></p>
<p>Here&#8217;s an example: </p>
<p>@example<br />import javafx.scene.geometry.*;<br />import javafx.scene.paint.*; </p>
<p>ShapeSubtract {<br />    fill: Color.BLACK<br />    a: Rectangle { width: 100 height: 50 }<br />    b: Ellipse { centerX: 100 centerY: 25 radiusX: 50 radiusY: 25}<br />} </p>
<p>Will produce the page you see in the screenshot above.</p>
<p>Tom Ball, a JavaFX development leader in Sun, added these comments in a reply: <strong><em>&#8220;It also lets *anyone* with basic XML transforming skills (lots of online tutorials) do things we never imagined.  One reason JavaDoc tends to look dated is that most developers have relied on whatever comes from Sun, instead of jumping in and raising the UI bar.  Now it is much more hackable&#8230;</p>
<p>This XML file is a database of a project&#8217;s attributes, which can not  only be data-mined to improve documentation, but to support many other  tools.  For example, a cscope-like source navigator is more easily done  than the original tool, as the XML model has more useful information  about the source.&#8221;</em></strong> </p>
<p>The ease of creating examples that are in-line with the documentation should encourage development of these examples, both in the JavaFX library API as well as in documentation that you and I as developers create for our projects.  Thanks Josh and the JavaFX development team for this facility!</p>
</div>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=203&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/compiled-javafx-script-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834011570fc1110970b-800wi" medium="image">
			<media:title type="html">JavaFXAuthoringTool</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401156f8c92b7970c-800wi" medium="image">
			<media:title type="html">Mojo</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401156f8c8a43970c-800wi" medium="image">
			<media:title type="html">Oradev_2009</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536e77be7970b-800wi" medium="image">
			<media:title type="html">ShapeDemoFX</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105363b0d3f970c-800wi" medium="image">
			<media:title type="html">Webstart.small2</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536e7b9b0970b-800wi" medium="image">
			<media:title type="html">Jfxtras_0-2_prog</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2ce47970b-800wi" medium="image">
			<media:title type="html">Security-warning-dialog</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536cc82c8970c-800wi" medium="image">
			<media:title type="html">Webstart.small2</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536c2d96a970b-800wi" medium="image">
			<media:title type="html">Security-warning-dialog-signed</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536cc9604970c-800wi" medium="image">
			<media:title type="html">Security-netbeans-self-signed</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" medium="image">
			<media:title type="html">Stockholm-09-Horizontal</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a15a3c970b-800wi" medium="image">
			<media:title type="html">Picture1</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a16007970b-800wi" medium="image">
			<media:title type="html">Picture2</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536a161e2970b-800wi" medium="image">
			<media:title type="html">Picture3</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d698834010536aa5f9e970c-800wi" medium="image">
			<media:title type="html">Webstart.small2</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/Stockholm-09-Horizontal.png" medium="image">
			<media:title type="html">Stockholm-09-Horizontal</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105369ae568970b-800wi" medium="image">
			<media:title type="html">JFXtras-Grid</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105367e8a5f970b-800wi" medium="image">
			<media:title type="html">JFXBuilder_ss</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105365389a1970b-800wi" medium="image">
			<media:title type="html">Eclipse_plugin</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d69883401053619b9cd970b-800wi" medium="image">
			<media:title type="html">Sten_breakout</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/.a/6a00e54f133d6988340105362281cc970c-800wi" medium="image">
			<media:title type="html">Inkscape_draw_with</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/07/03/examplesinjavafxdocs.png" medium="image">
			<media:title type="html">Examplesinjavafxdocs</media:title>
		</media:content>
	</item>
		<item>
		<title>Romain Guy&#8217;s Magic InfiniteProgressPanel</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/romain-guys-magic-infiniteprogresspanel/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/romain-guys-magic-infiniteprogresspanel/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:34:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/romain-guys-magic-infiniteprogresspanel/</guid>
		<description><![CDATA[I&#8217;ve mentioned how simple, elegant and powerful JavaFX Script is. Here&#8217;s a perfect example of these three qualities. A few weeks ago I wanted to show a progress indicator in a multi-tier application that has a rich client developed in JavaFX Script. Whenever the client is waiting for a response from the server, I wanted [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=202&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve mentioned how simple, elegant and powerful JavaFX Script is.  Here&#8217;s a perfect example of these three qualities.  A few weeks ago I wanted to show a progress indicator in a multi-tier application that has a rich client developed in JavaFX Script.  Whenever the client is waiting for a response from the server, I wanted to show this progress indicator.</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/08/infiniteprogresspanel_2.png"><img alt="Infiniteprogresspanel_2" title="Infiniteprogresspanel_2" src="http://learnjavafx.typepad.com/weblog/images/2008/01/08/infiniteprogresspanel_2.png" border="0" height="396" width="396" /></a>    </p>
<p>The screenshot above shows the InfiniteProgressPanel widget that I used from the JavaFX Script UI library.  It was invented by Romain Guy, a co-author of the book <em>Filthy Rich Clients</em>.  It is a great alternative to a progress bar due to the fact that you don&#8217;t have to continually calculate what percent complete the operation is.  This is because the progress bar is circular (and therefore infinite).  In addition, it is very easy to use: You just place the InfiniteProgressPanel in the UI containment hierarchy, and bind its <strong>progress</strong> attribute to a Boolean variable that is <strong>true</strong> whenever you want the progress indicator to appear.  Here&#8217;s the code for this compiled JavaFX Script example:</p>
<p>/*<br />*  CompiledInfiniteProgress.fx<br />*<br />*  Developed 2007 by James L. Weaver (jim.weaver at lat-inc.com)<br />*  to serve as a compiled JavaFX Script example.<br />*/</p>
<p>import javafx.ui.*;<br />import java.lang.System;</p>
<p>Frame {<br />  var busy = false<br />  title: &#8220;Infinite Progress Panel Demo&#8221;<br />  width: 400<br />  height: 400<br />  background: Color.WHITE<br />  visible: true<br />  onClose:<br />    function() {<br />      System.exit(0);<br />    }<br />  content:<br />    InfiniteProgressPanel {<br />      progress: bind busy<br />      content:<br />        FlowPanel {<br />          content: [<br />            Button {<br />              text: "Get Busy"<br />              action:<br />                function() {<br />                  busy = true;<br />                  ConfirmDialog {<br />                    title: "Patience is a Virtue"<br />                    message: "Simulating a busy condition"<br />                    visible:true<br />                    onYes:<br />                      function() {<br />                        busy = false<br />                      }<br />                  };<br />                }<br />            }<br />          ]<br />        }<br />    }<br />}</p>
<p>Please compile and run this example and try it out for yourself!  When you click the <strong>Get Busy</strong> button, the confirmation dialog will be displayed and the infinite progress indicator will appear.  When you dismiss the dialog by clicking the <strong>OK</strong> button, the progress indicator will disappear.  </p>
<p>By the way, the next several posts are going to highlight various UI widgets similar to the way this post does.  I&#8217;d like to give you an appreciation of the rich set of widgets available in JavaFX Script, and how easy they are to use.</p>
<p><strong>JavaFX Script Boot Camp Announcement<br /></strong>  </p>
<p>As a heads-up, I will be offering a JavaFX Script 2.5 day &#8220;boot camp&#8221; on Wednesday, April 9 through Friday, April 11, 2008 (ending at noon) in Indianapolis, Indiana.  This course is designed to get you quickly up to speed in JavaFX Script application development.  A primary reference for this course is my JavaFX Script book, but the course has its own syllabus which includes material covered in the book as well as up to the minute developments in compiled JavaFX Script.  Registration will open soon, and for this pilot class I am accepting 12 students.  The cost of this pilot class will be 900 USD per student.  Additional students from the same organization will be 600 USD.  You&#8217;ll need to bring your laptop computer with the latest versions of the JavaFX Script downloads (which I&#8217;ll specify in more detail as the class date approaches).  The prerequisite for the class will be the completion of a JavaFX Script programming assignment that I&#8217;ll post soon to this weblog.  I&#8217;m looking forward to teaching this class and hope that you can attend!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=202&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/romain-guys-magic-infiniteprogresspanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/01/08/infiniteprogresspanel_2.png" medium="image">
			<media:title type="html">Infiniteprogresspanel_2</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating Sliders in Compiled JavaFX Script</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/creating-sliders-in-compiled-javafx-script/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/creating-sliders-in-compiled-javafx-script/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:34:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/creating-sliders-in-compiled-javafx-script/</guid>
		<description><![CDATA[Beginning with the Romain Guy&#8217;s Magic InfiniteProgressPanel post, I&#8217;m in the process of showcasing some JavaFX Script UI components. I want you to get a feel for what components are available and how to use them in your code. Today&#8217;s feature is the Slider widget, and here&#8217;s a screenshot of an example program that uses [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=201&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Beginning with the <a href="http://learnjavafx.typepad.com/weblog/2008/01/romain-guys-mag.html">Romain Guy&#8217;s Magic InfiniteProgressPanel</a> post, I&#8217;m in the process of showcasing some JavaFX Script UI components.  I want you to get a feel for what components are available and how to use them in your code.  Today&#8217;s feature is the Slider widget, and here&#8217;s a screenshot of an example program that uses it:</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/14/sliderexample_2.png"><img alt="Sliderexample_2" title="Sliderexample_2" src="http://learnjavafx.typepad.com/weblog/images/2008/01/14/sliderexample_2.png" border="0" height="300" width="380" /></a>   <a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/14/sliderexample.png"><br /></a>   </p>
<p>As you move the slider, the Text graphic shown above changes.  Note that I chose a font that attempts to anthropomorphize the numbers. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </p>
<p>Here&#8217;s this example program&#8217;s code:</p>
<pre>/**  CompiledSpinner.fx - A compiled JavaFX program that demonstrates*                       the Slider widget.**/

import javafx.ui.*;import javafx.ui.canvas.*;

Frame {  var displayNum:Number = 0.0  height: 300  width: 380  title: "Slider Example"  background: Color.WHITE  content:    BorderPanel {      center:        Canvas {          content:            Text {              font:                Font {                  face: FontFace.BITSTREAM_VERA_SANS_MONO                  style: FontStyle.BOLD                  size: 96                }              x: 20              y: 40              stroke: Color.RED              fill: Color.RED              content: bind "{displayNum}"            }        }      bottom:        Slider {          min: 0          max: 100          border:            TitledBorder {              title: "Speed:"            }          value: bind displayNum with inverse          minorTickSpacing: 5          majorTickSpacing: 10          paintTicks: true          paintLabels: true          labels: [            SliderLabel {              value: 0              label:                SimpleLabel {                  text: "0"                }            },            SliderLabel {              value: 50              label:                SimpleLabel {                  text: "50"                }            },            SliderLabel {              value: 100              label:                SimpleLabel {                  text: "100"                }            }          ]        }    }  visible: true}</pre>
<p><strong>Noteworthy Concepts</strong></p>
<p>This weblog has covered most of the concepts in this example, but I do want to point out a couple of things:</p>
<ul>
<li>Up to this point I&#8217;ve used the <strong>faceName</strong> attribute of the <strong>Font</strong> class, but lately I&#8217;ve been using the <strong>face</strong> attribute.  The difference is that <strong>faceName</strong> is a <strong>String,</strong> and <strong>face</strong> is of type <strong>FontFace</strong>.  You can see the available constants for various font faces in <strong>FontFace.fx</strong> located in the <strong>javafx.ui</strong> package.</li>
<li>When binding a UI component that the user can modify (like this Slider) to a variable, the bind is bi-directional.  Bi-directional binding is expressed by adding <strong>with inverse</strong> at the end, as seen in the following statement from the code example:</li>
</ul>
<pre>        value: bind displayNum <strong>with inverse</strong></pre>
<p>Have fun with this example, and please post a comment if you have any questions, or if there are particular UI components that you&#8217;d like to see featured soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/201/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=201&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/creating-sliders-in-compiled-javafx-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/01/14/sliderexample_2.png" medium="image">
			<media:title type="html">Sliderexample_2</media:title>
		</media:content>
	</item>
		<item>
		<title>Turn the Page: Creating a Compiled JavaFX Script BookPanel</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/turn-the-page-creating-a-compiled-javafx-script-bookpanel/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/turn-the-page-creating-a-compiled-javafx-script-bookpanel/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:33:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/turn-the-page-creating-a-compiled-javafx-script-bookpanel/</guid>
		<description><![CDATA[I&#8217;d like to show you a novel (pardon the pun) and useful JavaFX Script widget called a BookPanel. It&#8217;s perfect for enabling the user to view content using a book metaphor. To turn pages, you can either press the buttons below the pages, or as shown in the screenshot below you can drag the mouse [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=200&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to show you a novel (pardon the pun) and useful JavaFX Script widget called a <strong>BookPanel</strong>.  It&#8217;s perfect for enabling the user to view content using a book metaphor.  To turn pages, you can either press the buttons below the pages, or as shown in the screenshot below you can drag the mouse to turn the pages:</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/14/compiledbookpanelexample_3.png"><img alt="Compiledbookpanelexample_3" title="Compiledbookpanelexample_3" src="http://learnjavafx.typepad.com/weblog/images/2008/01/14/compiledbookpanelexample_3.png" border="0" height="280" width="560" /></a> </p>
<p>Please take a look at the compiled JavaFX Script program that produced this output:</p>
<pre>/**  CompiledBookPanelExample.fx**  Developed 2007 by James L. Weaver (jim.weaver at lat-inc.com)*  to serve as a compiled JavaFX Script example.*/

import javafx.ui.*;import javafx.ui.canvas.*;import java.awt.Rectangle;import java.lang.System;

Frame {  var textFont =    Font {      face: FontFace.COMIC_SANS_MS      style: FontStyle.BOLD      size: 20    }  title: "Compiled BookPanel Example"  width: 700  height: 350  background: Color.WHITE  visible: true  onClose:    function() {      System.exit(0);    }  content:    BorderPanel {      var bookPanel =        BookPanel {          pageBounds: new Rectangle (0, 0, 350, 300)          leftPageIndex: 0          pages: [            BorderPanel {              background: Color.WHITE              border: LineBorder {}              center:                Canvas {                  content:                    Text {                      x: 10                      y: 100                      content: "Here I am - on the road again"                      font: textFont                      stroke: Color.RED                      fill: Color.RED                    }                }            },            BorderPanel {              background: Color.WHITE              border: LineBorder {}              center:                Canvas {                  content:                    Text {                      x: 10                      y: 100                      content: "There I am - up on the stage"                      font: textFont                      stroke: Color.BLUE                      fill: Color.BLUE                    }                }            },            BorderPanel {              background: Color.WHITE              border: LineBorder {}              center:                Canvas {                  content:                    Text {                      x: 10                      y: 100                      content: "Here I go - playing star again"                      font: textFont                      stroke: Color.GREEN                      fill: Color.GREEN                    }                }            },            BorderPanel {              background: Color.WHITE              border: LineBorder {}              center:                Canvas {                  content:                    Text {                      x: 10                      y: 100                      content: "There I go - turn the page"                      font: textFont                      stroke: Color.PURPLE                      fill: Color.PURPLE                    }                }            }          ]        }      center:        bookPanel      bottom:        FlowPanel {          content: [            Button {              text: "Previous Page"              enabled: bind bookPanel.leftPageIndex &gt; 0;              action:                function() {                  bookPanel.previousPage();                }            },            Button {              text: "Next Page"              enabled: bind bookPanel.leftPageIndex &lt; sizeof bookPanel.pages - 2;              action:                function() {                  bookPanel.nextPage();                }            }          ]        }    }}</pre>
<p>  <strong>Noteworthy Concepts</strong></p>
<p>I&#8217;d like to point some concepts from this example:</p>
<ul>
<li>A <strong>BookPanel</strong> instance is created using object literal syntax, but is assigned to a variable.  This variable is used later to access its <strong>previousPage()</strong> and <strong>nextPage()</strong> functions.</li>
<li>The <strong>pageBounds</strong> attribute of the <strong>BookPanel</strong> class is of type <strong>java.awt.Rectangle</strong>, which is in the Java SE class library.  This is an example of instantiating a Java class within a JavaFX Script program.</li>
<li>The <strong>enabled</strong> attribute of each Button is bound to an expression that calculates whether the Button should be operable.</li>
<li>The <strong>LineBorder</strong> associated with each page helps give a visual indication of its edges.</li>
</ul>
<p>Please be sure to compile and run this example so that you can experience the behavior of the BookPanel widget for yourself.</p>
<p><strong>JavaFX Script Boot Camp Announcement<br /></strong>  </p>
<p>As a heads-up, I will be offering a JavaFX Script 2.5 day &#8220;boot camp&#8221; on Wednesday, April 9 through Friday, April 11, 2008 (ending at noon) in Indianapolis, Indiana.  This course is designed to get you quickly up to speed in JavaFX Script application development.  A primary reference for this course is my JavaFX Script book, but the course has its own syllabus which includes material covered in the book as well as up to the minute developments in compiled JavaFX Script.  Registration will open soon, and for this pilot class I am accepting 12 students.  The cost of this pilot class will be 900 USD per student.  Additional students from the same organization will be 600 USD.  You&#8217;ll need to bring your laptop computer with the latest versions of the JavaFX Script downloads (which I&#8217;ll specify in more detail as the class date approaches).  The prerequisite for the class will be the completion of a JavaFX Script programming assignment that I&#8217;ll post soon to this weblog.  I&#8217;m looking forward to teaching this class and hope that you can attend!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=200&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/turn-the-page-creating-a-compiled-javafx-script-bookpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/01/14/compiledbookpanelexample_3.png" medium="image">
			<media:title type="html">Compiledbookpanelexample_3</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Dialog in Compiled JavaFX Script &#8211; and Bag the GridBag</title>
		<link>http://ngaongan.wordpress.com/2009/07/27/creating-a-dialog-in-compiled-javafx-script-and-bag-the-gridbag/</link>
		<comments>http://ngaongan.wordpress.com/2009/07/27/creating-a-dialog-in-compiled-javafx-script-and-bag-the-gridbag/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 00:33:00 +0000</pubDate>
		<dc:creator>ngaongan</dc:creator>
				<category><![CDATA[JavaFX]]></category>

		<guid isPermaLink="false">http://ngaongan.wordpress.com/2009/07/27/creating-a-dialog-in-compiled-javafx-script-and-bag-the-gridbag/</guid>
		<description><![CDATA[Today I&#8217;d like to show you how to create a dialog box in compiled JavaFX Script, as well as show you the GroupPanel layout component which is incredibly helpful in laying out dialog boxes. Here are the screenshots of the program&#8217;s UI, followed by the program&#8217;s code. I&#8217;ll wrap up this post with a discussion [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=199&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;d like to show you how to create a dialog box in compiled JavaFX Script, as well as show you the <code>GroupPanel</code> layout component which is incredibly helpful in laying out dialog boxes.  Here are the screenshots of the program&#8217;s UI, followed by the program&#8217;s code.  I&#8217;ll wrap up this post with a discussion that sheds some light on this example.</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/21/compiledgrouppanel_2.png"><img alt="Compiledgrouppanel_2" title="Compiledgrouppanel_2" src="http://learnjavafx.typepad.com/weblog/images/2008/01/21/compiledgrouppanel_2.png" border="0" height="250" width="400" /></a>    </p>
<p>When you click the <strong>Favorites</strong> menu item, the following dialog appears.  I&#8217;ve taken the liberty of filling out the fields:</p>
<p><a href="http://learnjavafx.typepad.com/photos/uncategorized/2008/01/21/compiledgrouppanel_dialog.png"><img alt="Compiledgrouppanel_dialog" title="Compiledgrouppanel_dialog" src="http://learnjavafx.typepad.com/weblog/images/2008/01/21/compiledgrouppanel_dialog.png" border="0" height="208" width="427" /></a>   </p>
<p>Here&#8217;s the program code:</p>
<pre>/**  CompiledGroupPanel.fx**  Developed 2008 by James L. Weaver (jim.weaver at lat-inc.com)*  to serve as a JavaFX Script example.*/

import javafx.ui.*;import java.lang.System;

Frame {  var dlg:Dialog  var firstName:String  var lastName:String  var favoriteBand:String  var favoriteMovie:String  title: "Bag the GridBag"  width: 400  height: 250  visible: true  menubar:    MenuBar {      menus: [        Menu {          text: "Options"          items: [            MenuItem {              text: "Favorites..."              action:                function():Void {                  dlg = Dialog {                    modal: true                    title: "Favorite Things"                    visible: true                    content:                      GroupPanel {                        var firstNameRow = Row { alignment: Alignment.BASELINE }                        var lastNameRow = Row { alignment: Alignment.BASELINE }                        var favoriteBandRow = Row { alignment: Alignment.BASELINE }                        var favoriteMovieRow = Row { alignment: Alignment.BASELINE }                        var labelsColumn = Column {                          alignment: Alignment.TRAILING                        }                        var fieldsColumn = Column {                          alignment: Alignment.LEADING                        }                        rows: [                          firstNameRow,                          lastNameRow,                          favoriteBandRow,                          favoriteMovieRow                        ]                        columns: [                          labelsColumn,                          fieldsColumn                        ]                        content: [                          SimpleLabel {                            row: firstNameRow                            column: labelsColumn                            text: "First Name:"                          },                          TextField {                            row: firstNameRow                            column: fieldsColumn                            columns: 15                            background: Color.WHITE                            focusTraversalKeysEnabled: true                            value: bind firstName with inverse                          },                           SimpleLabel {                            row: lastNameRow                            column: labelsColumn                            text: "Last Name:"                          },                          TextField {                            row: lastNameRow                            column: fieldsColumn                            columns: 15                            background: Color.WHITE                            focusTraversalKeysEnabled: true                            value: bind lastName with inverse                          },                           SimpleLabel {                            row: favoriteBandRow                            column: labelsColumn                            text: "Favorite Band:"                          },                          TextField {                            row: favoriteBandRow                            column: fieldsColumn                            columns: 20                            background: Color.WHITE                            focusTraversalKeysEnabled: true                            value: bind favoriteBand with inverse                          },                           SimpleLabel {                            row: favoriteMovieRow                            column: labelsColumn                            text: "Favorite Movie:"                          },                          TextField {                            row: favoriteMovieRow                            column: fieldsColumn                            columns: 25                            background: Color.WHITE                            value: bind favoriteMovie with inverse                          }                        ]                    }                    buttons: [                      Button {                        text: "OK"                        defaultButton: true                        action:                          function():Void {                            System.out.println("First name: {firstName}Last name: {lastName}Favorite band: {favoriteBand}Favorite movie: {favoriteMovie}");                            dlg.hide();                          }                      }                    ]                  };                }            }          ]        }      ]    }  onClose:    function():Void {      System.exit(0);    }}</pre>
<p><strong>Creating a Dialog  </strong></p>
<p>To create and display a dialog box, we&#8217;re creating an instance of the <code>Dialog</code> class, and setting its <code>visible</code> attribute to <code>true</code>.  We&#8217;re assigning a reference to the <code>Dialog</code> instance to the variable named <code>dlg</code>, so that its <code>hide()</code> function can be invoked when appropriate.  A <code>Dialog</code> has a <code>content</code> attribute which defines what will appear in the dialog, and it has a <code>buttons</code> attribute that allows you to define the buttons and their functionality when activated.</p>
<p><strong>Using the Most Excellent GroupPanel Layout Component</strong></p>
<p>For some reason, I&#8217;ve always resisted using the <strong>GridBagLayout</strong> in Java.  I know that others have used it successfully, but I just seem to prefer using a combination of layout managers to get the job done.  One especially thorny layout task for me (using either approach) has been creating a column of labels that have corresponding UI components beside them, all neatly lined up as shown in the previous screenshot.  The <strong>GroupPanel</strong> layout component excels at this task, allowing you to define named rows and columns, and their alignments.  You then place each UI component at a given row and column.</p>
<p>This example uses the <code>bind with inverse</code> keywords to keep the UI in sync with the model (which in this simple example program is some variables defined in the declarative expression).  To demonstrate that the binding works, the values that you enter in the dialog box are printed to the console when you active the <strong>OK</strong> button in the dialog box.</p>
<p><strong>JavaFX Script Boot Camp Announcement</strong> </p>
<p>As a heads-up, I will be offering a JavaFX Script 2.5 day &#8220;boot camp&#8221; on Wednesday, April 9 through Friday, April 11, 2008 (ending at noon) in Indianapolis, Indiana.  This course is designed to get you quickly up to speed in JavaFX Script application development.  A primary reference for this course is my JavaFX Script book, but the course has its own syllabus which includes material covered in the book as well as up to the minute developments in compiled JavaFX Script.  Registration will open soon, and for this pilot class I am accepting 12 students.  The cost of this pilot class will be 900 USD per student.  Additional students from the same organization will be 600 USD.  You&#8217;ll need to bring your laptop computer with the latest versions of the JavaFX Script downloads (which I&#8217;ll specify in more detail as the class date approaches).  The prerequisite for the class will be the completion of a JavaFX Script programming assignment that I&#8217;ll post soon to this weblog.  I&#8217;m looking forward to teaching this class and hope that you can attend!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngaongan.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngaongan.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngaongan.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngaongan.wordpress.com&amp;blog=6187841&amp;post=199&amp;subd=ngaongan&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngaongan.wordpress.com/2009/07/27/creating-a-dialog-in-compiled-javafx-script-and-bag-the-gridbag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/216ee15cb0f2ac57fa213770d27e73f8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngaongan</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/01/21/compiledgrouppanel_2.png" medium="image">
			<media:title type="html">Compiledgrouppanel_2</media:title>
		</media:content>

		<media:content url="http://learnjavafx.typepad.com/weblog/images/2008/01/21/compiledgrouppanel_dialog.png" medium="image">
			<media:title type="html">Compiledgrouppanel_dialog</media:title>
		</media:content>
	</item>
	</channel>
</rss>
