<?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/"
	>

<channel>
	<title>Steve On Java &#187; top-10</title>
	<atom:link href="http://steveonjava.com/tag/top-10/feed/" rel="self" type="application/rss+xml" />
	<link>http://steveonjava.com</link>
	<description>Hacking JavaFX and Java with Agility</description>
	<lastBuildDate>Wed, 08 Sep 2010 01:42:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>JavaFX 1.3 Top 10</title>
		<link>http://steveonjava.com/javafx-1-3-top-10/</link>
		<comments>http://steveonjava.com/javafx-1-3-top-10/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 21:45:40 +0000</pubDate>
		<dc:creator>steveonjava</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[javafx 1.3]]></category>
		<category><![CDATA[top-10]]></category>

		<guid isPermaLink="false">http://steveonjava.com/?p=1112</guid>
		<description><![CDATA[


		
		
		
		JavaFX 1.3 has just gone live on JavaFX.com.  This release is deceptively small, but has an enormous number of changes under the hood.  In this post I will take you through the Top 10 major features, giving you background information I learned from working with the JavaFX team, and flooding you with details on interesting [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: left;margin-right: 0.75em;; margin-top: 4px; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fsteveonjava.com%252Fjavafx-1-3-top-10%252F%22%2C%20%22shorturl%22%3A%20%22http%3A%2F%2Fbit.ly%2F9AVafu%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22JavaFX%201.3%20Top%2010%22%20%7D);"></div>
<!--S-ButtonZ 1.1.5 Start--><div style="float: left; width: 42px; padding-right: 10px; margin: 0 10px 0 0;">
		<script type="text/javascript">
		<!--
		var dzone_url = "http://steveonjava.com/javafx-1-3-top-10/";
		var dzone_title = "JavaFX 1.3 Top 10";
		var dzone_style = "1";
		var dzone_blurb = "";
		//-->
		</script>
		<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script></div><!--S-ButtonZ 1.1.5 End--><p>JavaFX 1.3 has just gone live on <a href="http://javafx.com/">JavaFX.com</a>.  This release is deceptively small, but has an enormous number of changes under the hood.  In this post I will take you through the Top 10 major features, giving you background information I learned from working with the JavaFX team, and flooding you with details on interesting tidbits you might otherwise miss.</p>
<h2>JavaFX 1.3 Top 10 Features</h2>
<p><a rel="attachment wp-att-1113" href="http://steveonjava.com/javafx-1-3-top-10/javafx1-3-top-ten/"><img class="alignnone size-full wp-image-1113" title="javafx1.3-top-ten" src="http://steveonjava.com/wp-content/uploads/2010/04/javafx1.3-top-ten.jpg" alt="" width="449" height="404" /></a></p>
<h4>1. New Controls</h4>
<p><span id="more-1112"></span>JavaFX 1.3 comes with several new controls that are extremely useful when designing user interfaces.  For building forms you have the new PasswordBox, ChoiceBox, and Separator classes.  The PasswordBox is similar to the TextBox control, except it automatically hides input as it is typed.  The ChoiceBox control is long overdue, but surprisingly simple to use.  The interface is similar to the ListView control, both of which take a sequence of items.</p>
<p>Speaking of the ListView, this control has received a serious upgrade.  This includes the ability to render horizontally or vertically as well as customizable cell renderers via a cellFactory closure.</p>
<p>In addition, there is a new ScrollView class that simplifies the task of creating a simple scrollable viewport surrounding a collection of nodes.  This has been a feature in <a href="http://jfxtras.org/">JFXtras</a> for a while, so it is nice to see that the JavaFX team thought it was useful enough to add to the core libraries.</p>
<p>Finally, all controls now take a Tooltip that will be displayed on rollover.</p>
<p>To bring it all together, here is a simple example that demonstrates all the new controls in action:</p>
<p><a rel="attachment wp-att-1150" href="http://steveonjava.com/javafx-1-3-top-10/controldemo/"><img class="alignnone size-full wp-image-1150" title="Control Demo" src="http://steveonjava.com/wp-content/uploads/2010/04/ControlDemo.png" alt="" width="266" height="288" /></a></p>
<p>And here is the source code:</p>
<pre class="brush: javafx;">

import javafx.scene.control.*;
import javafx.scene.layout.VBox;
import javafx.geometry.Insets;

var list = [&quot;apples&quot;, &quot;bananas&quot;, &quot;oranges&quot;, &quot;pears&quot;, &quot;cabbage&quot;];

ScrollView {
  width: 250
  height: 250
  managed: false
  node: VBox {
    padding: Insets {top: 10, left: 10, bottom: 10, right: 10}
    spacing: 10
    content: [
      PasswordBox {promptText: &quot;enter password&quot;}
      Separator {}
      ChoiceBox {
        items: list
      }
      ListView {
        vertical: false
        items: list
      }
    ]
  }
}
</pre>
<h4>2. Layout Enhancements</h4>
<p><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val="&#45;-" /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--> <!--[if gte mso 10]><br />
<mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} --></p>
<p><!--[endif]--></p>
<p class="MsoNormal">Layout has undergone some serious changes as a result of this release, including the following:</p>
<ul>
<li>LayoutInfo and Resizable now include settings for fill, grow, and shrink.  Fill will allow you to specify whether the contents of a layout stop at their preferredSize or take up the maximum allowable space.  Grow and shrink are hints to the container about the relative priority for different nodes to get the available space.</li>
<li>LayoutInfo also includes a new margin feature, which makes it very easy to add visual padding around your Nodes in a layout!  This is in addition to padding, which appears on all the built-in layouts.</li>
<li>Container has a new snapToPixel boolean that allows you to create pixel-perfect alignments to avoid unwanted aliasing effects.</li>
<li>There is a new autoSize feature on Groups.<span> </span>Children will be automatically resized to their preferred width and height, preventing layout bugs when uninitialized components return the wrong bounds initially.<span> </span>You can still disable this feature, but it is strongly recommended that you fix your application to make use of preferred widths and heights instead of setting Node width and height manually.</li>
<li>Resizable classes automatically have layoutBounds set to [0, 0, width, height], avoiding an additional required declaration.</li>
<li>New support for baseline layouts via the TextOrigin class.</li>
<li>The Tile class now automatically sizes the tileWidth and tileHeight by default.</li>
<li>HPos and VPos have boolean for fillHeight and fillWidth, which rarely should be changed, but allow you to default back to the pre 1.3 behavior.</li>
</ul>
<p>For the most part, the JavaFX team has done an amazing job of keeping the layout changes backwards compatible.  However, to fully take advantage of the new layout features you will have to update your code.</p>
<p>The layout changes are significant enough that I can&#8217;t do them justice in this short blurb.  However, either myself or <a href="http://www.java.net/blogs/aim/">Amy Fowler</a> (whoever makes it first) will do an in depth article on just this one topic!</p>
<h4>3. Performance</h4>
<p>There have been some very significant changes in performance in the JavaFX 1.3 release all the way down to the compiler generated code.</p>
<p>Some areas you will notice the largest performance improvement in include:</p>
<ul>
<li>Bind performance &#8211; All binds in the language are now lazy by default, which means that they will get marked as dirty immediately, but only get re-evaluated when needed (if at all).</li>
<li>General code performance &#8211; With the compiler rewrite, a level of indirection on variable access has been removed, which will significantly improve the overall performance of any application.</li>
<li>Layout performance &#8211; The layout code has been optimized to reduce the number of passes required on each layout cycle, greatly improving the perceived responsiveness of applications.</li>
<li>Text performance &#8211; With the change to logical rather than physical layout bounds, any applications that heavily use Text elements will see a dramatic improvement in overall performance.</li>
<li>CSS performance &#8211; The CSS support has been rewritten from the ground up, greatly improving performance of applied styles.</li>
</ul>
<h4>4. Enhanced CSS</h4>
<p>The CSS support in JavaFX 1.3 has been rewritten from the ground up.  This includes some greatly enhanced functionality, especially for the Control classes, and also has a dramatic improvement on performance.</p>
<p>Because the changes are so significant, you may find that a lot of your previous styles do not work correctly on the 1.3 release.  The full set of CSS changes and supported tags is such a large topic that I will provide a link to the full JavaFX CSS specification once it is made available.</p>
<p>Dean Iverson has done an excellent writeup of some of the new CSS capabilties here: <a href="http://pleasingsoftware.blogspot.com/2010/04/advanced-javafx-control-styling.html">Advanced  JavaFX Control Styling</a></p>
<h4>5. 3D Support</h4>
<p>Via the new, experimental Prism graphics stack you can start experimenting with 3D graphics in your JavaFX applications.  Some of the new APIs that you will see throughout the JavaFX documentation for working with 3D graphics include:</p>
<ul>
<li>New Camera classes for changing the viewing perspective of the Scene, including a ParallelCamera that does orthographic projections and a PerspectiveCamera that can be used to see things in full 3D</li>
<li>Transition changes to accept a three dimensional axis on RotationTransition, ScaleTransition, and TranslateTransition</li>
<li>A completely revamped set of transform classes that accept z coordinates</li>
<li>A new Point3D class as well as changes to BoundingBox and Bounds to accept a third dimension</li>
<li>The addition of rotationAxis, scaleZ, and translateZ on all scene graph Nodes</li>
</ul>
<p>To use 3D in your applications you will need to enable the prism graphics stack with the following JVM argument:</p>
<pre class="brush: plain;">

-Xtoolkit prism
</pre>
<p>Runtime you can validate whether 3D is enabled or not using the new Platform and ConditionalFeature classes like this:</p>
<pre class="brush: javafx;">

Platform.isSupported(ConditionalFeature.3D);
</pre>
<p>The best example of JavaFX 3D in action is Jim Weaver&#8217;s new <a href="http://learnjavafx.typepad.com/weblog/2010/04/your-calendar-pwn3d-leveraging-the-javafx-scene3d-conditionalfeature.html">3D Calendar Cube post</a>.</p>
<p><a href="http://learnjavafx.typepad.com/weblog/2010/04/your-calendar-pwn3d-leveraging-the-javafx-scene3d-conditionalfeature.html"><img class="alignnone size-thumbnail wp-image-1122" title="CalendarCube3D" src="http://steveonjava.com/wp-content/uploads/2010/04/CalendarCube3D-150x150.png" alt="" width="150" height="150" /></a></p>
<h4>6. TV Emulator</h4>
<p>For the first time, JavaFX 1.3 includes a TV Emulator as part of the distribution.  This gives you the chance to compile and test your applications against the new TV profile, and sometime in the near future deploy it to the big screen!</p>
<p>The easiest way to change your application to run against the TV profile is to select the &#8220;Run in TV Emulator&#8221; option in the NetBeans Properties dialog.  From the command line you can accomplish the same thing by passing in &#8220;-profile TV&#8221; to both the compiler and JavaFX runtime.</p>
<p>Here is a screenshot of the TV Emulator in action:</p>
<p><a rel="attachment wp-att-1116" href="http://steveonjava.com/javafx-1-3-top-10/displayshelftv/"><img class="alignnone size-full wp-image-1116" title="DisplayShelfTV" src="http://steveonjava.com/wp-content/uploads/2010/04/DisplayShelfTV.png" alt="" width="340" height="260" /></a></p>
<p>The biggest change you will notice is the different icon in the upper-left hand corner of the screen.  From a development perspective, it feels very similar to the desktop experience, but you need to keep in mind the following constraints:</p>
<ul>
<li>Screen Distance &#8211; Your end users will be sitting 5 to 6 feet away from the screen, so your entire application has to be designed to be visually distinctive at a distance.</li>
<li>Remote Interaction &#8211; TV viewers do not typically sit on their couches with full QWERTY keyboards, so your UI will need to be designed to be fully operational from a common remote control.  This can make navigation, selection, and text input much more challenging.</li>
</ul>
<p>If you are interested to see a live demonstration of JavaFX TV, join us in person or for the live web stream of our <a href="http://www.svjugfx.org/calendar/13260637/">June SvJugFX meeting</a> with Mikhail Gorshenev from the JavaFX TV development team.</p>
<h4>7. Conditional Features</h4>
<p>I mentioned a little bit about conditional features in the 3D section above.  However, having conditional features is itself an extremely important feature.</p>
<p>In previous release of JavaFX if you wanted to make use of certain features, such as effects, that were only in the desktop profile, you were required to remove these from your code to compile against mobile.  With the addition of conditional features you can now safely include these features in your application and they will be silently ignored if they are not supported on your platform.</p>
<p>This takes the concept of write once, run anywhere to a new level in JavaFX, greatly simplifying development on platforms that only support the common profile!</p>
<p>Here is a short program that will print out whether or not each of the conditional features is enabled for your platform:</p>
<pre class="brush: javafx;">
import javafx.runtime.*;

println(&quot;Effect enabled: {Platform.isSupported(ConditionalFeature.EFFECT)}&quot;);
println(&quot;Input Method enabled: {Platform.isSupported(ConditionalFeature.INPUT_METHOD)}&quot;);
println(&quot;Scene 3D enabled: {Platform.isSupported(ConditionalFeature.SCENE3D)}&quot;);
println(&quot;Shape Clip enabled: {Platform.isSupported(ConditionalFeature.SHAPE_CLIP)}&quot;);
</pre>
<h4>8. Custom Cursors</h4>
<p>You are no longer limited to the set of default cursors defined on the Cursor class.  Using the new ImageCursor class you can take any JavaFX Image and turn it into a mouse cursor.</p>
<p>This capability was recently released as a part of the <a href="http://steveonjava.com/jfxtras-0-6-final-released/">JFXtras 0.6 Release</a> thanks to the hard work of Jeff Friesen, but is a very welcome addition to the core API!  Now all that is needed is an implementation of Jeff&#8217;s <a href="http://today.java.net/article/2009/07/27/introducing-custom-paints-javafx">custom paints</a>.</p>
<h4>9. Faster Animation</h4>
<p>JavaFX 1.3 has a new cacheHint option on Nodes that allows you to degrade performance while animations are taking place.  Perceptually it is hard for the user to notice the loss of quality, but it can have a very big difference in performance of your application.  This is a staple of other JavaFX scene graph technologies like <a href="http://piccolo2d.org/">Piccolo2D</a>, so it is good to see progress on this in the JavaFX 1.3 release.</p>
<p>There is a great example of how to use this new capability right in the <a href="http://java.sun.com/javafx/1.3/docs/api/javafx.scene/javafx.scene.Node.html">JavaFX Node API docs</a> (duplicated here for convenience):</p>
<pre class="brush: javafx;">
 expensiveNode.cache = true;
 expensiveNode.cacheHint = CacheHint.QUALITY;
 ...
 // Do an animation
 expensiveNode.cacheHint = CacheHint.SPEED;
 Timeline {
     keyFrames: [
         KeyFrame {
             time: 2s
             values: [
                 expensiveNode.scaleX =&gt; 2.0,
                 expensiveNode.scaleY =&gt; 2.0,
                 expensiveNode.rotate =&gt; 360,
                 expensiveNode.cacheHint =&gt; CacheHint.QUALITY
             ]
        }
     ]
 }.play();
</pre>
<h4>10. Preview Features</h4>
<p>In addition to the public API, JavaFX 1.3 contains a number of top secret new features!  These are features that are not final, but are very usable if you are willing to live with future API changes.  All of the preview features are grouped under the com.javafx.preview package, and include the following:</p>
<ul>
<li>Grid &#8211; A Grid layout that makes it much simpler to layout nodes in perfectly aligned rows and columns.  The original layout code was donated by the <a href="http://jfxtras.org/">JFXtras team</a>, and productized by the amazing layout skills of Amy Fowler.</li>
<li>MenuBar/PopupMenu &#8211; This is the completed version of Jonathan Giles very popular <a href="http://jonathangiles.net/blog/?p=566">Menu control</a>.  He is now a core member of the JavaFX Control Team, and plugging away at bringing this and other great controls to the hands of JavaFX developers.</li>
<li>TreeView &#8211; A full implementation of a hierarchical tree in JavaFX complete with TreeItems and TreeCells.</li>
<li>ToolBar &#8211; A palette-like control that lets you create rows of tool buttons with icons and text.  This is the handiwork of Paru Somashekar.</li>
</ul>
<p>In a future post I will go into more detail on usage of these preview features, which greatly extend the power of JavaFX!</p>
<h2>Other Noteworthy Features</h2>
<p>Besides the major features mentioned above, there are also thousands of little changes that have made it in to the 1.3 release.  While I don&#8217;t have time (or room) to cover all of them in detail, here are some other noteworthy features that you can take advantage of in your applications:</p>
<ul>
<li>New Amble font &#8211; JavaFX now includes its own high fidelity fonts that are consistent across all platforms.  Since this is the new default font, you may notice that the spacing and alignment of your existing applications may be slightly off.</li>
<li>Timelines can now be paused.  There is also an evaluateKeyValues that allows you to reevaluate the value portion of your animation (whatever is on the right side of the =&gt;) on demand (normally the value is evaluated once before the first Timeline execution).</li>
<li>You can get exceptions that occur while processing JSON/XML via the new exception variable on Event.</li>
<li>PullParsers can now be run asynchronously using the new ParserTask class.</li>
<li>FXD now supports node selection via an XPath-like syntax and has metadata support on nodes, which is exposed as a map to the application.</li>
<li>There is a new Bounds class for representing widths and heights.</li>
<li>Builtins has a new isReadOnly function, which tells you if a variable is bound.  No more catching AssignToBoundException!</li>
<li>Durations are now Comparable, have new constants for one and zero, and a new static TYPE_INFO variable.</li>
<li>CustomNode now has a publicly exposed children sequence.  This makes it much easier to work with scenegraph navigation.  It also solves a potentially perplexing issue with object initialization order.  You should definitely make use of the new children sequence rather than overriding the old create function.</li>
<li>The infernal scene graph warning is gone!  You can now move a node around the scenegraph without worrying about removing it from the previous parent.  Stuart Marks has a <a href="http://stuartmarks.wordpress.com/2009/12/04/that-infernal-scene-graph-warning-message-ii/">great blog post</a> about this.</li>
<li>Node has a new pickOnBounds variable that lets you change the active hit region to be the logical rather than the physical bounds.</li>
<li>All container nodes (Group, CustomNode, Container, Control) now extend Parent and have a children sequence, greatly simplifying scene graph traversal.</li>
<li>Text supports logical and physical bounds.  Big performance improvement with the new default of logical!</li>
<li>Improved charts…  background lines, shading, and cleaner text.  Here is a before and after picture:</li>
</ul>
<p><a rel="attachment wp-att-1131" href="http://steveonjava.com/javafx-1-3-top-10/chartbeforeandafter/"><img class="alignnone size-full wp-image-1131" title="Chart Before and After" src="http://steveonjava.com/wp-content/uploads/2010/04/chartBeforeAndAfter.png" alt="" width="626" height="327" /></a></p>
<h2>Additional Resources</h2>
<p>The JavaFX team did a great job of documenting the new features and migration to JavaFX 1.3 in the following articles:</p>
<ul>
<li><a href="http://javafx.com/docs/articles/javafx1-3.jsp">What&#8217;s New in  JavaFX 1.3</a></li>
<li><a href="http://javafx.com/docs/articles/porting-guide-javafx1-3.jsp">JavaFX  1.3 Migration Guide</a></li>
</ul>
<p>And not to be outdone, Jim Weaver had the very first external post about the 1.3 release emphasizing the new 3D capabilities:</p>
<ul>
<li><a href="http://learnjavafx.typepad.com/weblog/2010/04/your-calendar-pwn3d-leveraging-the-javafx-scene3d-conditionalfeature.html">Your Calendar PWN3D: Leveraging the JavaFX SCENE3D ConditionalFeature</a></li>
</ul>
<p>Since this post first appeared, some excellent resources have come up:</p>
<ul>
<li><a href="http://pleasingsoftware.blogspot.com/2010/04/advanced-javafx-control-styling.html">Advanced JavaFX Control Styling</a> by Dean Iverson</li>
<li></li>
</ul>
<p>As additional resource become available, I will continue to update this section.</p>
<h2>Conclusion</h2>
<p>I hope you enjoyed this whirlwind tour through all the new features of the JavaFX 1.3 release.  There is a lot of goodness here, some of which I might have missed, so please comment on any features of the 1.3 release that you enjoy using!</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 4976px; width: 1px; height: 1px; overflow: hidden;">
<h3 class="entry-header">Your Calendar PWN3D: Leveraging the JavaFX  SCENE3D ConditionalFeature</h3>
</div>
<div style="clear:both;">&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://steveonjava.com/javafx-1-3-top-10/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>JavaFX 1.2 Top 10 and Migration Guide</title>
		<link>http://steveonjava.com/javafx-1-2-top-10/</link>
		<comments>http://steveonjava.com/javafx-1-2-top-10/#comments</comments>
		<pubDate>Sun, 31 May 2009 13:37:09 +0000</pubDate>
		<dc:creator>steveonjava</dc:creator>
				<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[top-10]]></category>

		<guid isPermaLink="false">http://steveonjava.com/?p=269</guid>
		<description><![CDATA[


		
		
		
		Note 1: I am following Jim Weaver&#8217;s lead, since he discovered JavaFX 1.2 is downloadable from javafx.com. Enjoy the new release!
Note 2: I have updated the section below on nativearray.  Please use with caution!
The JavaFX 1.2 release is a huge upgrade from 1.1, both in terms of functionality and API improvements.  This means there are [...]]]></description>
			<content:encoded><![CDATA[
<div class="topsy_widget_data topsy_theme_blue" style="float: left;margin-right: 0.75em;; margin-top: 4px; background: url(data:,%7B%20%22url%22%3A%20%22http%253A%252F%252Fsteveonjava.com%252Fjavafx-1-2-top-10%252F%22%2C%20%22style%22%3A%20%22big%22%2C%20%22title%22%3A%20%22JavaFX%201.2%20Top%2010%20and%20Migration%20Guide%22%20%7D);"></div>
<!--S-ButtonZ 1.1.5 Start--><div style="float: left; width: 42px; padding-right: 10px; margin: 0 10px 0 0;">
		<script type="text/javascript">
		<!--
		var dzone_url = "http://steveonjava.com/javafx-1-2-top-10/";
		var dzone_title = "JavaFX 1.2 Top 10 and Migration Guide";
		var dzone_style = "1";
		var dzone_blurb = "";
		//-->
		</script>
		<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script></div><!--S-ButtonZ 1.1.5 End--><p><span style="color:#000080;"><strong>Note 1</strong>: I am following Jim Weaver&#8217;s lead, since he discovered JavaFX 1.2 is downloadable from <a href="http://javafx.com/">javafx.com</a>. Enjoy the new release!</span></p>
<p><span style="color:#993300;"><strong>Note 2</strong>: I have updated the section below on nativearray.  Please use with caution!</span></p>
<p>The JavaFX 1.2 release is a huge upgrade from 1.1, both in terms of functionality and API improvements.  This means there are lots of cool new things to take advantage of, but at the same time you will spend quite a lot of time migrating your applications.</p>
<p>Fortunately, after upgrading <a href="http://jfxtras.org/">JFXtras</a>, <a href="http://widgetfx.org/">WidgetFX</a>, and dozens of sample applications for the <a href="http://projavafx.com/">Pro JavaFX Platform</a> book, I have this all down to a science.  In the rest of this blog I will take you through a whirlwind tour of the relevant new features, and most common migration hurdles so you can be up and running in record time!</p>
<p>First the fun stuff&#8230;  new features.  Here are the top 10 features you should start using today:</p>
<div id="attachment_312" class="wp-caption alignnone" style="width: 459px"><img class="size-full wp-image-312" title="JavaFX Top 10 Revised" src="http://steveonjava.files.wordpress.com/2009/05/javafx-1-2-top-101.jpg" alt="JavaFX Top 10 Revised" width="449" height="404" /><p class="wp-caption-text">JavaFX Top 10 Features (revised)</p></div>
<p><strong>1. Skinnable UI Controls</strong></p>
<p>It is great to have some pure JavaFX controls, such as Button, ListView, ProgressBar, and Slider that don&#8217;t rely on Swing peers underneath.  An added advantage is that they are fully skinnable to match the fonts and color palette of your application.</p>
<p><strong>2. New Layout Classes</strong></p>
<p>The new layout classes including Tile, Stack, Flow, ClipView, and Panel are a very welcome addition!  The layout API has also gotten a lot cleaner, which makes it easier to write your own layouts, such as the <a href="http://jfxtras.org/">JFXtras Grid</a>.</p>
<p><strong>3. Charting Support: Area, Bar, Bubble, Line, Pie, Scatter, X/Y</strong></p>
<p>Now I can compete with my Flex buddies on business oriented RIAs!  The new charting and graphing support is a must for any enterprise applications, so I am glad to see it made the cut.</p>
<p><strong><span id="more-269"></span>4. RSS/Atom Feed Support</strong></p>
<p>Having built-in RSS/Atom feed support is a welcome addition, and will make it much easier to write feed-based applications that cleanly port from the desktop to mobile.</p>
<p><strong>5. Local Data Storage</strong></p>
<p>An easy way to save state between sessions, no Web Start API hacking required!  See the new Resource and Storage classes in the javafx.io package for details.</p>
<p><strong>6. Stage Infrastructure: Screen and Alerts</strong></p>
<p>There is some new functionality that makes it easy to pop-up alert dialogs, or work directly with the screen bounds.  While you could have done direct Swing/Java2D hacks before, this helps keep your code mobile safe.</p>
<p><strong>7. Improved Asynchronous Processing Model</strong></p>
<p>The new Task class supercedes the AsynchronousAbstractOperation with a clean API for calling long-running tasks.  The code running in the background has to be coded in Java, but if you are looking for a JavaFX alternative see the <a href="http://jfxtras.googlecode.com/svn/site/javadoc/release-0.4/org.jfxtras.async/org.jfxtras.async.JFXWorker.html">JFXWorker</a> (which is part of the JFXtras project).</p>
<p><strong>8. BoxBlur effect</strong></p>
<p>Finally, a high-performance alternative to Gaussian blur.  This is now the default for DropShadow, which should speed up a lot of applications!</p>
<p><strong>9. Math and Properties Classes</strong></p>
<p>There are new JavaFX equivalents for java.lang.Math and java.util.Properties in the javafx.util package.  Make sure you use these instead so your application is portable to mobile.</p>
<p><strong>10. High Performance Referencing of Java Arrays (<span style="color:#993300;">updated!</span>)</strong></p>
<p>Java arrays are now optimized so that they can be used directly from JavaFX code without conversion to a sequence.  This can have a huge performance gain in programs transfering large models between Java and JavaFX code, and is transparent to the application developer.</p>
<p><strong>Note</strong>: There is experimental support for direct creation of Java arrays in JavaFX using the nativearray keyword.  Use with caution, because this functionality may be removed at any time.</p>
<p> Now that you are incentivized to upgrade, it is time to figure out how to migrate your existing applications.</p>
<h1>The Definitive 1.2 Migration Guide</h1>
<p>If you have made it this far, you are a serious JavaFX hacker!  This section covers the most common language, functionality, and API changes that you will encounter when migrating applications from JavaFX 1.1.  If you notice anything that is not covered, feel free to add it in the comments and I will update the guide as appropriate.</p>
<p><strong>General:</strong></p>
<ul>
<li><em>JavaFX 1.2 is <strong>not </strong>binary compatible</em> &#8211; If you use any jars or third-party JavaFX libraries (such as JFXtras), they must be recompiled for the new release or you will get compilation errors.  Speaking of <a href="http://jfxtras.org">JFXtras</a>, a new version which has been updated for JavaFX 1.2 is nearly ready, and will be announced here when it is complete!</li>
<li><em>All internal-only APIs are broken</em> &#8211; More details broken out by section below, but if you rely on any impl_ or com.sun packages, your code will definitely need to be updated.</li>
<li><em>Linux and Solaris are now supported</em> &#8211; This is more of a feature than a migration issue, but if you have users on multiple platforms you can now proudly state that Linux is supported.</li>
</ul>
<p><strong>Language Changes:</strong></p>
<ul>
<li><em>No more variable shadowing in nested blocks</em> &#8211; It previously was valid to name a variable the same in both the inner and outer block of an expression.  The variable in the inner block would simply replace the one in the outer.  However, this will throw a compiler error in JavaFX 1.2.  The fix is simple&#8230;  just use a different variable name.</li>
<li><em>Use Mixins instead of Multiple Inheritance</em> &#8211; JavaFX no longer supports multiple inheritance.  Instead you can extend one class and as many mixins as you like.  Mixins are like interfaces in Java, except they can have variables and implementations that are shared by all the classes that extend them.  The only change you have to make in your application to start using mixins is to add the mixin keyword when you define a new class like this:</li>
</ul>
<pre>public mixin class Resizable { /* variables and functions here */ }</pre>
<ul>
<li><em>Commas are required in sequences</em> &#8211; Sequences now require commas between elements (except those that end in braces).  This is a little less convenient, but actually a very good thing, because it avoids several language pitfalls that were hard to track down before.</li>
</ul>
<p><strong>Node Changes:</strong></p>
<ul>
<li><em>Node.boundsInScene is gone</em> &#8211; This was removed for performance reasons, fortunately there is an easy replacement that offers the same functionality:</li>
</ul>
<pre>node.localToScene(node.boundsInLocal)</pre>
<ul>
<li><em>Node.focusable -&gt; Node.focusTraversable</em> &#8211; Small API change, but good to know when you get the compilation error on focusable not found.  This is part of a larger focus fix where any Node that is visible, focusTraversable, and not disabled will be eligible for focus (a key listener is no longer required).</li>
<li><em>CustomNode.create() gets called before init</em> &#8211; Previously the CustomNode create() method would get called after init and before postinit.  Now that it gets called even earlier than init, some of your code may not work correctly.  Make sure that any variables you are depending upon in the create() method are either initialized inline or have a bind declaration so they get updated once set.</li>
<li><em>SwingControl.enabled -&gt; Node.disable</em> &#8211; There is a new disable flag on the Node class that is used universally across all controls to enable or disable them.  This conflicted with the old SwingControl.enabled variable, which has now been removed.</li>
<li><em>Rectangle2D -&gt; Bounds</em> &#8211; All references to Rectangle2D have been changed to the new javafx.geometry.Bounds class, which may have a ripple effect through your code.</li>
</ul>
<p><strong>Layout Changes:</strong></p>
<ul>
<li><em>min/max/pref -&gt; getters</em> &#8211; All of the Resizable methods (minimumWidth, minimumHeight, maximumWidth, maximumHeight, preferredWidth, preferredHeight) have been replace with function getters (getMinWidth, getMinHeight, getMaxWidth, getMaxHeight, getPrefWidth, getPrefHeight respectively).  The prefWidth/Height functions take an extra parameter, which is the amount of space in the opposite dimension.  This is very useful for doing height or width constrained layouts, such as Flows, but can be ignored by passing -1.</li>
<li><em>impl_layoutX/Y -&gt; layoutX/Y</em> &#8211; The impl_layoutX and impl_layoutY methods have been replaced with official layoutX and layoutY variables.  It is recommended that you use these variables over translateX/Y if you are moving nodes into position.</li>
<li><em>impl_requestLayout() -&gt; requestLayout()</em> &#8211; The requestLayout function has similarly moved from an internal to a public API.</li>
<li><em>impl_layout -&gt; doLayout()</em> &#8211; Rather than having a function to set the layout on, you now override Parent.doLayout().</li>
<li><em>Panel class added for declarative layouts</em> &#8211; If you are looking for a functional alternative to Container, take a look at the new Panel class, which lets you set the layout declaratively.  It also has variables to override the default min/max/pref values without subclassing Container.</li>
<li><em>New functions on Container to help with layouts</em> &#8211; There are a whole slew of new functions on the Container class that make it easier to work with the new layout system.  Make sure to read through them, because they will both save you time and help you follow the best practices for layout design.</li>
<li><em>Different transformation order</em> &#8211; Previously the transforms[] variable allowed you to apply transformations included in the layoutBounds, while scaleX/translateX/rotate etc. were applied after layout.  Now both transforms[] and the transformation variables are calculated after layout uniformly.</li>
</ul>
<p><strong>Skin/Control Changes:</strong></p>
<ul>
<li><em>Skin.scene -&gt; Skin.node</em> &#8211; The name of the Node on Skin has changed from scene to node, which helps reduce confusion with the Scene class.</li>
<li><em>Skin.compute* methods removed</em> &#8211; There were a series of computePreferredWidth/Height/etc. methods that were removed.  Instead you can directly use the getPrefWidth/Height/etc. methods on the Resizable class mentioned above.</li>
<li><em>Skin is now abstract</em> &#8211; The Skin class is now abstract, and required that you implement your own contains and intersects methods.  You can either do this by using the new JFXtras AbstractSkin class or using the following boilerplate code:</li>
</ul>
<pre>override function contains(localX:Number, localY:Number):Boolean {
    return node.contains(localX, localY);
}

override function intersects(localX:Number, localY:Number, localWidth:Number, localHeight:Number):Boolean {
    return node.intersects(localX, localY, localWidth, localHeight);
}</pre>
<ul>
<li><em>New Behavior class</em> &#8211; There is a new Behavior class that is meant to be used together with Control and Skin to provide reusable behaviors.</li>
<li><em>TextBox.text -&gt; rawText, TextBox.value -&gt; text</em> &#8211; There was some swizzling of variables on the TextBox class.  What used to be text changed to rawText, and value now has the same semantics text used to have.</li>
</ul>
<p><strong>Asynchronous Changes:</strong></p>
<ul>
<li><em>RemoteTextDocument has been removed</em> &#8211; Use HttpRequest directly instead.</li>
<li><em>AbstractAsyncOperation has been removed</em> &#8211; Use the new Task infrastructure instead for communcating with Java code running in a background thread.</li>
</ul>
<p><strong>Animation Changes:</strong></p>
<ul>
<li><em>Transition.interpolate -&gt; Transition.interpolator</em> &#8211; A small name change to make room for a new interpolate flag that allows you to turn on or off interpolation altogether.</li>
<li><em>Transition now extends Timeline </em>- This is a welcome change, which makes it much easier to work with Transitions and Timelines together.  To support this change ParallelTransition and SequentialTransition now take a sequence of Timeliens.</li>
</ul>
<p><strong>Java Equivalent Functions:</strong></p>
<ul>
<li><em>java.lang.Math -&gt; javafx.util.Math</em> &#8211; There is a new JavaFX math library, which is a drop-in replacement for the Java math library.  The main advantage of using the new JavaFX math library is that all functions are supported on mobile devices (including pow, log, etc.).</li>
<li><em>java.lang.Properties -&gt; javafx.util.Properties</em> &#8211; Another class that is similar in functionality to the Java equivalent, but portable to mobile.  Be warned, however, that the JavaFX properties file format is not the same as the standard Java properties file format.</li>
</ul>
<p><strong>CSS Changes:</strong></p>
<ul>
<li><em>CSS Update Defect (RT-4817)</em> &#8211; Stylesheet updates no longer affect newly added Nodes due to a known defect.  In the meantime, you can do this to force a stylesheet refresh:</li>
</ul>
<pre>def senators = bind model.senators on replace {
    delete sceneRef.stylesheets;
    sceneRef.stylesheets = "{__DIR__}styles.css";
}</pre>
<ul>
<li><em>CheckBoxSkin.textFill doesn&#8217;t accept styles (RT-4819) </em>- The check mark will pick up the style you set, but the text won&#8217;t.  The workaround for now is to create a checkbox with empty text and add a text node beside it with the correct styling and event handlers.</li>
<li><em>Can&#8217;t update the skin property of Control from CSS (RT-4820)</em> &#8211; Another bug in the skin support.  You can set this in code instead for now.</li>
</ul>
<p><strong>Production Suite:</strong></p>
<ul>
<li><em>UiStub -&gt; FXDNode</em> &#8211; UiStub has been replaced with FXDNode, which includes some extra functionality, such as backgroundLoading, and placeholder images.</li>
</ul>
<p><strong>Miscellaneous:</strong></p>
<ul>
<li><em>Image.fromBufferedImage() removed</em> &#8211; This has moved to SwingUtils.toFXImage().  Remember that if you use this function it will limit portability to mobile devices.</li>
<li><em>Color.fromAWTColor() removed</em> &#8211; Yet another AWT-ism that has been removed. The JavaFX Color class is pretty thorough, so there shouldn&#8217;t be any reason to work with AWT Colors.</li>
<li><em>Duration.toDate is gone</em> &#8211; As far as I know there is no equivalent functionality, but you can always get a duration&#8217;s value as a long and manipulate it directly.</li>
<li><em>Different variable names for the Affine class</em> &#8211; If you use the Affine class, then your code is likely to break due to the new, more descriptive, method names, but the functionality is the same.</li>
</ul>
<p>Whew!  &#8230;that was quite a lot to take in.  If you are interested to read more about the JavaFX 1.2 release including the new controls, layouts, and other functionality, the best source is to checkout the Pro JavaFX book that Jim, Dean, Weiqi, and I are writing.  It is almost fully updated for the JavaFX 1.2 release, and is available in Alpha right now from the <a href="http://projavafx.com/">book website</a>.</p>
<p>I want to give a special thanks to <a href="http://weblogs.java.net/blog/rbair/">Richard Bair</a> and <a href="http://weblogs.java.net/blog/aim/">Amy Fowler</a> from the Sun JavaFX team for providing a lot of valuable information on the JavaFX 1.2 release along the way.</p>
<h1>Happy hacking on JavaFX 1.2!</h1>
<div style="clear:both;">&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://steveonjava.com/javafx-1-2-top-10/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
	</channel>
</rss>
