<?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>Jasper Potts&#039;s Blog &#187; JavaFXApplications</title>
	<atom:link href="http://www.jasperpotts.com/blog/category/javafxapplications/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jasperpotts.com/blog</link>
	<description>Jasper Potts&#039;s Blog on Java and Life</description>
	<lastBuildDate>Mon, 30 Jan 2012 07:03:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Devoxx/Parleys.com Intro Video in JavaFX</title>
		<link>http://www.jasperpotts.com/blog/2009/01/devoxxparleyscom-intro-video/</link>
		<comments>http://www.jasperpotts.com/blog/2009/01/devoxxparleyscom-intro-video/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 16:18:44 +0000</pubDate>
		<dc:creator>Jasper Potts</dc:creator>
				<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaFXApplications]]></category>
		<category><![CDATA[Devoxx]]></category>
		<category><![CDATA[Devoxx 2008]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Parleys.com]]></category>

		<guid isPermaLink="false">http://www.jasperpotts.com/blog/?p=158</guid>
		<description><![CDATA[Following on from the success of the JavaFX Devoxx animations Stephan Janssen asked if I could do a similar video to replace last years intro video that is played before the start of each of the recorded sessions. I decided this was another chance to see how JavaFX copes with animation. This time I needed a 10-15second clip [...]]]></description>
			<content:encoded><![CDATA[<p>Following on from the success of the <a href="http://www.jasperpotts.com/blog/2009/01/devoxx-themed-swish-demo/">JavaFX Devoxx animations</a> Stephan Janssen asked if I could do a similar video to replace last years intro video that is played before the start of each of the recorded sessions. I decided this was another chance to see how JavaFX copes with animation. This time I needed a 10-15second clip of PAL video 768&#215;576 25fps. In this blog I will explain how I created this animation and take you though recreating it step by step. I started out creating the graphics in Photoshop based on the ones I had from the Devoxx theme for Swish with all the parts that I am going to need to animate as separate layers. All the layers I want to access from JavaFX are named with the &#8220;jfx:&#8221; prefix and simple camel case names so they will be exposed to JavaFX code and come though as neat variable names.</p>
<div id="attachment_159" class="wp-caption alignnone" style="width: 528px"><img class="size-full wp-image-159" title="complete" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/complete.png" alt="Complete Graphics" width="518" height="393" /><p class="wp-caption-text">Complete Graphics</p></div>
<p><span id="more-158"></span>You can download the final graphics photoshop file <a href="http://jasperpotts.com/blogfiles/devox-intro-video/final-graphics.psd">here</a>, once you have this you will need Photoshop CS3 or CS4 and the JavaFX Production Suite (<a href="http://javafx.com/downloads/">download here</a>). If you don&#8217;t have Photoshop you can download a trial version to experiment with or use any design tool that will export SVG and the Production Suite convertor. Alternatively you could just save each layer as a PNG and hand code a scene graph with ImageViews for each layer. Once you have production suite installed in Photoshop you can go to &#8220;File&#8221; -&gt; &#8220;Automate&#8221; -&gt; &#8216;Save for JavaFX&#8230;&#8221; then save the graphics as &#8220;graphics.fxz&#8221; in the package directory in the source directory of a new Netbeans JavaFX project. You can then right click on the saved &#8220;fxz&#8221; file in Netbeans and choose &#8220;Generate UI Stub&#8230;&#8221; that will create a JavaFX &#8220;.fx&#8221; source file that is a scene graph Node class that you can use in your application. It will have variables for direct access to each of the layers you named in Photoshop with the &#8220;jfx:&#8221; prefix. Before you can compile the project with the newly generated stub you need to go to project properties and add the &#8220;JavaFX FXD 1.0&#8243; library to the project. Now all the code you need in Main to create a JavaFX application to display our graphics is this:</p>
<pre lang="JAVA">var graphics:graphicsUI;

Stage {
    title: "Devoxx Video Intro"
    scene: Scene {
        // PAL Video Sized
        width: 768 height: 576
        content: graphics = graphicsUI{}
        fill: Color.BLACK
    }
}</pre>
<p>So run that and check it out, cool hey! So now its time to start animating it, lets start with the background. The background is made up of 3 layers so we can animate them.</p>
<p> </p>
<div id="attachment_161" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-161" title="background" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/background.png" alt="Moody orange base background" width="318" height="243" /><p class="wp-caption-text">Moody orange base background</p></div>
<div id="attachment_162" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-162" title="clouds" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/clouds.png" alt="Clouds layer" width="318" height="243" /><p class="wp-caption-text">Clouds layer</p></div>
<div id="attachment_165" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-165" title="bar" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/bar.png" alt="Bar - grey is transparent" width="318" height="243" /><p class="wp-caption-text">Bar - grey is transparent</p></div>
<p>The clouds layer is semi transparent and we are going to animate it slowly scrolling past to add mood it sits above the moody orange background and under the black bar. The graphics for it were created to match at the ends so it can be looped without you seeing the join. I created it by using the render clouds effect in photoshop, the result I duplicated and flipped about the middle so that both ends were the same and then hand blended the join. That way I knew it would repeat without a seam. In JavaFX I am going to make a second ImageView with the clouds as I need enough to scroll completely past the visible region then jump back and start again. Here is the code for this:</p>
<pre lang="JAVA">// Make copy of clouds image view so we have enough to scroll past
var cloudsGroup:Group = graphics.clouds_group as Group;
var clouds1:ImageView = graphics.clouds as ImageView;
clouds1.x = 0;
var clouds2:ImageView = ImageView {
    image: clouds1.image
    translateX: bind clouds1.image.width
}
insert clouds2 into cloudsGroup.content;

// == Animate clouds ===========================================================
TranslateTransition {
    node: cloudsGroup
    fromX: 0
    toX: -clouds1.image.width
    duration: 10s
    autoReverse: false
    repeatCount: Timeline.INDEFINITE
    interpolate: Interpolator.LINEAR
}.play();</pre>
<p>Once I have created and positioned the second could imageview I create a TranslateTransition to animate the clouds scrolling past and start it playing. Next is the 3 spotlights:</p>
<p> </p>
<div id="attachment_166" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-166" title="lights" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/lights.png" alt="Lights - 3 separate transparent layers" width="318" height="243" /><p class="wp-caption-text">Lights - 3 separate transparent layers</p></div>
<p>The spotlights will animate rotating around the center of their top. To rotate around a point other than the center of a node we will have to use a Transform and Timeline as the RotateTransition only works around the center of the node.</p>
<pre lang="JAVA">// == Animate lights ===========================================================
var light1:ImageView = graphics.light1 as ImageView;
var light2:ImageView = graphics.light2 as ImageView;
var light3:ImageView = graphics.light3 as ImageView;
var light1angle = -20;
var light2angle = -20;
var light3angle = -20;
light1.transforms = Rotate { pivotX: light1.x + (light1.layoutBounds.width / 2) angle: bind light1angle };
light2.transforms = Rotate { pivotX: light2.x + (light2.layoutBounds.width / 2) angle: bind light2angle };
light3.transforms = Rotate { pivotX: light3.x + (light3.layoutBounds.width / 2) angle: bind light3angle };

var light1Timeline:Timeline = Timeline {
    keyFrames: [
         at (0s) {light1angle => -20 tween Interpolator.EASEBOTH}
         at (3s) {light1angle => 20 tween Interpolator.EASEBOTH}
     ]
    repeatCount: Timeline.INDEFINITE
    autoReverse: true
};
var light2Timeline:Timeline = Timeline {
    keyFrames: [
         at (0s) {light2angle => -20 tween Interpolator.EASEBOTH}
         at (3.5s) {light2angle => 20 tween Interpolator.EASEBOTH}
     ]
    repeatCount: Timeline.INDEFINITE
    autoReverse: true
};
var light3Timeline:Timeline = Timeline {
    keyFrames: [
         at (0s) {light3angle => -25 tween Interpolator.EASEBOTH}
         at (2.5s) {light3angle => 20 tween Interpolator.EASEBOTH}
     ]
    repeatCount: Timeline.INDEFINITE
    autoReverse: true
};</pre>
<p>The first part of the code create 3 variables &#8220;light1angle&#8221;,&#8221;light2angle&#8221; and &#8221;light3angle&#8221; then setup Rotate Tranforms on the 3 light nodes whose angle is bound to these variables. We then create 3 timelines to animate the panning of the spotlights. Note: I have not started the animations here as I will do that in the final master timeline but you can add quick &#8220;light1Timeline.play();&#8221; style lines to test it out so far.  Next is the speaker chap(dude for americans):</p>
<p> </p>
<div id="attachment_168" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-168" title="speaker" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/speaker.png" alt="Speak Chap - 2 layers head and body" width="318" height="243" /><p class="wp-caption-text">Speak Chap - 2 layers head and body</p></div>
<p>The first animation for the speaker chap is to rotate his head back and forward. This is simple as in photoshop I manipulated the center point of the layer by adding a pixel at the right point to get the center where I needed it. Because of that we can just use a simple RotateTransition:</p>
<pre lang="JAVA">// == Chap Head Rotation ================================================================
var headRotation:RotateTransition = RotateTransition {
    fromAngle: -5
    toAngle: 5
    autoReverse: true
    duration: 1s
    interpolate: Interpolator.EASEBOTH
    repeatCount: Timeline.INDEFINITE
    node: graphics.head
};</pre>
<p>Again I have not started this transition as it will be started at the right point in the master timeline. Next I will setup a clip on the group containing the chap&#8217;s head and body and link it to a variable that controls the beam position. This is so I can BEAM him in <img src='http://www.jasperpotts.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  for a bit of fun.</p>
<p> </p>
<div id="attachment_169" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-169" title="beam" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/beam.png" alt="Beam layer" width="318" height="243" /><p class="wp-caption-text">Beam layer</p></div>
<p>The &#8220;scanLocation&#8221; variable can be from 0.0 fully invisible to 1.0 fully visible. We will animate this later to beam the chap in.</p>
<pre lang="JAVA">// == Chap scan ================================================================
var chap:Group = graphics.chap as Group;
var chapX:Number = chap.layoutBounds.minX;
var chapY:Number = chap.layoutBounds.minY;
var chapWidth:Number = chap.layoutBounds.width;
var chapHeight:Number = chap.layoutBounds.height;
var beam:ImageView = graphics.beam as ImageView;
var scanLocation:Number = 0.7 on replace {
    beam.y = chapY+(chapHeight*scanLocation) - (beam.layoutBounds.height/2);
};
chap.clip = Rectangle {
    x: chapX
    translateY: bind chapY-chapHeight+(chapHeight*scanLocation)
    width: chapWidth
    height: chapHeight
};</pre>
<p>Next is the title text, this is made in 3 layers:</p>
<p> </p>
<div id="attachment_170" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-170" title="text" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/text.png" alt="Base text including small glow" width="318" height="243" /><p class="wp-caption-text">Base text including small glow</p></div>
<div id="attachment_171" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-171" title="text-glow" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/text-glow.png" alt="Larger glow for text" width="318" height="243" /><p class="wp-caption-text">Larger glow for text</p></div>
<div id="attachment_172" class="wp-caption alignnone" style="width: 328px"><img class="size-full wp-image-172" title="glow-mask" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/glow-mask.png" alt="Mask for large glow" width="318" height="243" /><p class="wp-caption-text">Mask for large glow</p></div>
<p>We will animate the glow mask across the text exposing a small part of the larger glow as we go, this will give the effect of a glow sweeping across the text. In the code for this I setup the mask image as a clip on the text glow layer and calculate the start and end positions for the animation.</p>
<pre lang="JAVA">// == Glow Mask ================================================================
var glow:ImageView = graphics.glow as ImageView;
var glowMaskGraphics:ImageView = graphics.glowMask as ImageView;
glowMaskGraphics.visible = false;
var glowX:Number = glow.layoutBounds.minX;
var glowWidth:Number = glow.layoutBounds.width;
var glowMaskWidth:Number = glowMaskGraphics.layoutBounds.width;
var glowMaskStart:Number = glowX - glowMaskWidth;
var glowMaskEnd:Number = glowX + glowWidth + glowMaskWidth;
var glowMaskPosition:Number = glowMaskStart;
var glowMask:ImageView = ImageView {
    image: glowMaskGraphics.image
    x: bind glowMaskPosition
    y: glowMaskGraphics.y
};
glow.clip = glowMask;</pre>
<p>We have a music recording from Devoxx of the beatboxer Roxorloops that we are going to use for the sound track for this intro so next we need to setup the media ready to be played.</p>
<pre lang="JAVA">// == Setup Music ==============================================================

var music:MediaPlayer = MediaPlayer {
    media: Media { source: "http://jasperpotts.com/blogfiles/devox-intro-video/IntroBeat.mp3" }
    autoPlay: true
}
music.stop();</pre>
<p>That is all the setup done for the little animations, now we need to get started on the master timeline which is going to control the sequence of all the animations. First create a bunch of constants for all the times of the key points in the animation. This is handy as I can play with the timing to get it feeling right and in sync with the sound without having to dig too deeply into the code.</p>
<pre lang="JAVA">// == Main Animation Times =====================================================
def FRAME:Duration = 1s/60;

def START:Duration = 5s;
def FIRST_LIGHT:Duration = START + 0.2s;
def SECOND_LIGHT:Duration = FIRST_LIGHT + 3s;
def THIRD_LIGHT:Duration = SECOND_LIGHT + 1s;
def START_SHOW_CHAP:Duration = THIRD_LIGHT + 1s;
def END_SHOW_CHAP:Duration = START_SHOW_CHAP + 1s;
def START_SHOW_TEXT:Duration = END_SHOW_CHAP + 1s;
def END_SHOW_TEXT:Duration = START_SHOW_TEXT + 1s;
def START_GLOW_SCAN:Duration = END_SHOW_TEXT + 0.5s;
def END_GLOW_SCAN:Duration = START_GLOW_SCAN + 5s;
def START_HIDE:Duration = END_GLOW_SCAN + 0.5s;
def END_HIDE:Duration = START_HIDE + 1.5s;</pre>
<p>Then the final part is the main timeline that fades layers in and out and starts the smaller animations at the right points. This is the last of the code and you have the completed application.</p>
<pre lang="JAVA">// == Main Animation ===========================================================
Timeline {
    keyFrames: [
        KeyFrame {
            time: 0s
            values: [
                beam.visible => false
                graphics.bar.visible => false
                graphics.chap.visible => false
                graphics.background.opacity => 0
                graphics.flames.opacity => 0
                graphics.light1.opacity => 0
                graphics.light2.opacity => 0
                graphics.light3.opacity => 0
                graphics.text.opacity => 0
            ]
            action: function() { light1Timeline.play(); }
        }
        KeyFrame { // start second light a little later as we don't want them in sync
            time: 1s
            action: function() { light2Timeline.play(); }
        }
        KeyFrame { // start music
            time: START - 0.1s
            action: function() {
                music.currentTime = 0s;
                music.play();
            }
        }
        KeyFrame { // start after couple seconds in as a chance to stablize after launch
            time: START
            values: [
                graphics.background.opacity => 0
                graphics.flames.opacity => 0
                graphics.light1.opacity => 0
                graphics.light2.opacity => 0
                graphics.light3.opacity => 0
                graphics.bar.visible => true
            ]
            action: function() { light3Timeline.play(); }
        }
        KeyFrame {
            time: FIRST_LIGHT
            values: [
                graphics.light3.opacity => 0.6 tween Interpolator.LINEAR

                graphics.background.opacity => 0.1 tween Interpolator.EASEIN
                graphics.flames.opacity => 0.1 tween Interpolator.EASEIN
            ]
        }
        KeyFrame {
            time: SECOND_LIGHT - 0.2s
            values: graphics.light1.opacity => 0.0
        }
        KeyFrame {
            time: SECOND_LIGHT
            values: [
                graphics.light1.opacity => 0.6 tween Interpolator.LINEAR

                graphics.background.opacity => 0.6 tween Interpolator.EASEIN
                graphics.flames.opacity => 0.6 tween Interpolator.EASEIN
            ]
        }
        KeyFrame {
            time: THIRD_LIGHT - 0.2s
            values: graphics.light2.opacity => 0.0
        }
        KeyFrame {
            time: THIRD_LIGHT
            values: [
                graphics.light2.opacity => 0.6 tween Interpolator.LINEAR

                graphics.background.opacity => 1.0 tween Interpolator.EASEIN
                graphics.flames.opacity => 1.0 tween Interpolator.EASEIN
            ]
        }
        KeyFrame {
            time: START_SHOW_CHAP - 0.2s
            values: [
                beam.opacity => 0.0
                beam.visible => true
            ]
        }
        KeyFrame {
            time: START_SHOW_CHAP
            values: [
                graphics.chap.visible => true
                beam.opacity => 1.0 tween Interpolator.EASEIN
                scanLocation => 0.0
            ]
        }
        KeyFrame {
            time: END_SHOW_CHAP
            values: [
                beam.visible => false
                scanLocation => 1.0 tween Interpolator.EASEIN
            ]
            action: function() { headRotation.play(); }
        }
        KeyFrame {
            time: START_SHOW_TEXT
            values: [
                graphics.text.opacity => 0.0
            ]
        }
        KeyFrame {
            time: END_SHOW_TEXT
            values: [
                graphics.text.opacity => 1.0
                graphics.glow.visible => true
            ]
        }
        KeyFrame {
            time: START_GLOW_SCAN
            values: [
                glowMaskPosition => glowMaskStart
            ]
        }
        KeyFrame {
            time: END_GLOW_SCAN
            values: [
                glowMaskPosition => glowMaskEnd tween Interpolator.EASEBOTH
            ]
        }
        KeyFrame {
            time: START_HIDE
            values: [
                graphics.opacity => 1.0 tween Interpolator.EASEOUT
            ]
        }
        KeyFrame {
            time: END_HIDE
            values: [
                graphics.opacity => 0.0 tween Interpolator.EASEOUT
            ]
        }
        KeyFrame {
            time: END_HIDE + 3s
            action: function () { FX.exit(); }
        }
    ]
}.play();</pre>
<p>So we are finally there, if you have been following along then you can run what you have for the rest of you here is a web start link: </p>
<p><a href="http://jasperpotts.com/blogfiles/devox-intro-video/Devoxx_Video_Intro.jnlp" onclick="javascript:urchinTracker ('/blogfiles/devox-intro-video/Devoxx_Video_Intro.jnlp');" title="Launch Intro Video App" target="_blank"><img src="/blogfiles/launch.jpg" align="absmiddle" border="0" /></a></p>
<p> You can also download the Netbeans project complete with FXZ graphics file: <a onclick="javascript:urchinTracker ('/blogfiles/devox-intro-video/project.zip');" href="http://jasperpotts.com/blogfiles/devox-intro-video/project.zip">Netbeans Project</a>. The first session with the new intro video is already live on <a href="http://Parleys.com">Parleys.com</a> watch it here <a href="http://parleys.com/display/PARLEYS/Home#talk=23691268;slide=1;title=Inside%20the%20SpringSource%20Application%20Platform">&#8220;Inside the SpringSorce Application Platform&#8221;</a>. Well I hope you enjoyed my longest blog so far and a cool little application.</p>
<p><i><b>Update:</b> Some people have been having problems with a media bug playing the sound, I am passing it on to the Media Team in the mean time here is a webstart link without music:</i></p>
<p><a href="http://jasperpotts.com/blogfiles/devox-intro-video/Devoxx_Video_Intro_NoMusic.jnlp" onclick="javascript:urchinTracker ('/blogfiles/devox-intro-video/Devoxx_Video_Intro_NoMusic.jnlp');" title="Launch Intro Video App" target="_blank"><img src="/blogfiles/launch.jpg" align="absmiddle" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasperpotts.com/blog/2009/01/devoxxparleyscom-intro-video/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
<enclosure url="http://jasperpotts.com/blogfiles/devox-intro-video/IntroBeat.mp3" length="256586" type="audio/mpeg" />
		</item>
		<item>
		<title>Introduction to JavaFX Talks &#8211; Devoxx 2008 &#8211; IJTC 2009</title>
		<link>http://www.jasperpotts.com/blog/2009/01/introduction-to-javafx-talks-devoxx-2008-ijtc-2009/</link>
		<comments>http://www.jasperpotts.com/blog/2009/01/introduction-to-javafx-talks-devoxx-2008-ijtc-2009/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 12:28:15 +0000</pubDate>
		<dc:creator>Jasper Potts</dc:creator>
				<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaFXApplications]]></category>

		<guid isPermaLink="false">http://www.jasperpotts.com/blog/?p=139</guid>
		<description><![CDATA[Over the last couple months Richard Bair, Martin Brehovsky and I presented talks introducing JavaFX at Devoxx 2008, Sun Paris Tech Day and IJTC 2009 (Irish Java Technologies Conference). There are 2 versions a longer one for Devoxx and a more condensed version for Paris and IJTC. For those of you interested here are the slides and demos: Slides [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last couple months <a title="Richard's Blog" href="http://weblogs.java.net/blog/rbair/">Richard Bair</a>, Martin Brehovsky and I presented talks introducing JavaFX at <a title="Devoox" href="http://www.devoxx.com/display/JV08/Home">Devoxx 2008</a>, Sun Paris Tech Day and <a href="http://ijtc.firstport.ie/">IJTC 2009</a> (Irish Java Technologies Conference). There are 2 versions a longer one for Devoxx and a more condensed version for Paris and IJTC. For those of you interested here are the slides and demos:</p>
<h3>Slides</h3>
<p><a class="wp-caption" title="Devoxx Slides" onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/javafx-devoxx.pdf');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/javafx-devoxx.pdf"><img class="alignnone size-full wp-image-140" title="devoxx-slide" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/devoxx-slide.png" alt="devoxx-slide" width="408" height="309" /></a></p>
<p><a class="wp-caption" title="Devoxx Slides" onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/javafx-devoxx.pdf');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/javafx-devoxx.pdf">Devoxx Slides PDF</a></p>
<p><a class="wp-caption" title="IJTC Slides" onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/javafx-ijtc.pdf');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/javafx-ijtc.pdf"><img class="alignnone size-full wp-image-141" title="ijtc slide" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/slide.png" alt="ijtc slide" width="408" height="308" /></a></p>
<p><a class="wp-caption" title="IJTC Slides" onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/javafx-ijtc.pdf');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/javafx-ijtc.pdf">IJTC Slides PDF</a></p>
<h3>Demo</h3>
<p>During the talks we built up a simple demo with what you learn in each section.</p>
<p><img class="alignnone size-full wp-image-143" title="talk-demo" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/talk-demo.png" alt="talk-demo" width="500" height="363" /></p>
<p>Here are the links so you can webstart the demos for the different sections, I started at Demo 2d as that is the first version with working close button which is always helpful <img src='http://www.jasperpotts.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/Talk_Demo2.jnlp');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/Talk_Demo2.jnlp"><img class="alignnone size-full wp-image-144" title="talk-demo-2d" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/talk-demo-2d.png" alt="talk-demo-2d" width="180" height="194" /></a><a onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/Talk_Demo3.jnlp');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/Talk_Demo3.jnlp"><img class="alignnone size-full wp-image-145" title="talk-demo-3" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/talk-demo-3.png" alt="talk-demo-3" width="180" height="194" /></a></p>
<p><a onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/Talk_Demo3.jnlp');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/Talk_Demo3.jnlp"></a><a onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/Talk_Demo4.jnlp');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/Talk_Demo4.jnlp"><img class="alignnone size-full wp-image-146" title="talk-demo-4" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/talk-demo-4.png" alt="talk-demo-4" width="180" height="194" /></a><a onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/Talk_Demo5.jnlp');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/Talk_Demo5.jnlp"><img class="alignnone size-full wp-image-147" title="talk-demo-5" src="http://www.jasperpotts.com/blog/wp-content/uploads/2009/01/talk-demo-5.png" alt="talk-demo-5" width="180" height="194" /></a></p>
<p>Here is the Netbeans project and source files for these demos so you can play with them.</p>
<p><a title="talk-demo.zip" onclick="javascript:urchinTracker ('/blogfiles/javafx-intro-talk/talk-demo.zip');" href="http://jasperpotts.com/blogfiles/javafx-intro-talk/talk-demo.zip">Netbeans-Project.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasperpotts.com/blog/2009/01/introduction-to-javafx-talks-devoxx-2008-ijtc-2009/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>JavaFX Sketching Application</title>
		<link>http://www.jasperpotts.com/blog/2009/01/javafx-sketching-application/</link>
		<comments>http://www.jasperpotts.com/blog/2009/01/javafx-sketching-application/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 20:01:00 +0000</pubDate>
		<dc:creator>Jasper Potts</dc:creator>
				<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaFXApplications]]></category>

		<guid isPermaLink="false">http://www.jasperpotts.com/blog/?p=90</guid>
		<description><![CDATA[A friend forwarded a email to me a couple days ago from a researcher who wanted to record children sketching on a computer using a graphics tablet. So they could play it back later and watch how they did it etc. It sounded like a cool little app and as I was bored while waiting [...]]]></description>
			<content:encoded><![CDATA[<p>A friend forwarded a email to me a couple days ago from a researcher who wanted to record children sketching on a computer using a graphics tablet. So they could play it back later and watch how they did it etc. It sounded like a cool little app and as I was bored while waiting for a plane back from the IJTC conferance I thought I would have a quick go, how hard can it be <img src='http://www.jasperpotts.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><span id="more-90"></span>So here is what I had after a couple hours:</p>
<p><script src="http://dl.javafx.com/dtfx.js"></script><br />
 <script type="text/javascript"><!--
     javafx({archive: "http://jasperpotts.com/blogfiles/sketch/Sketch.jar",width: 600,height: 450,code: "sketch.Main",name: "Sketch"});
// --></script></p>
<p>The biggest challenge I had was to stop adding more and more features as it was so easy. If I do some more then I would like to make it save to my website so I can have a gallery of what people have created that other people can replay, maybe next time I have a flight I will do that.</p>
<p>To start with I just wanted to create a simple canvas that I could scribble on and see how it worked, I was suprised how simple it was. Here is the code:</p>
<pre lang="JAVA">Stage{
    title: "Sketch"
    scene:
    scene = Scene{
        width: 400
        height: 400
        content: [
            lines
            Rectangle {
                width: bind scene.width
                height: bind scene.height
                fill: Color.TRANSPARENT
                onMousePressed: function (e:MouseEvent) {
                    insert currentPath = Path{
                        elements: MoveTo{ x: e.x y: e.y }
                    } into lines.content;
                }
                onMouseDragged: function (e:MouseEvent) {
                    insert LineTo{ x: e.x y: e.y } into currentPath.elements;
                }
                onMouseReleased: function (e:MouseEvent) {
                    insert LineTo{ x: e.x y: e.y } into currentPath.elements;
                    currentPath = null;
                }
            }
        ]
    }
}</pre>
<p>It works pretty well for such a basic way of doing it but is limited by the frequency at which it receives mouse events. Interestingly it works way better with a graphics tablet than a mouse as you seem to get many more events. There are also some Java libraries out there for interfacing with graphics tablets to get pressure and tilt information so we could link that in to vary the stroke width for example. I also thought about algorithms that could convert the series of points into smooth curves. There are loads of cool things that could be done with this but it is amazing how useable the dumb/simple version is.</p>
<p>If you would like the Netbeans project with the source so you can play with it <a title="Spline Editor Src" onclick="javascript:urchinTracker ('/blogfiles/sketch/Sketch.zip');" href="http://jasperpotts.com/blogfiles/sketch/Sketch.zip" target="_blank">Dowload Here</a>. If you have any extra features you add please send them to me and I will post a new version. If there is much interest then we could create a opensource project for a JavaFX Painting application.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasperpotts.com/blog/2009/01/javafx-sketching-application/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>JavaFX Spline Editor</title>
		<link>http://www.jasperpotts.com/blog/2009/01/javafx-spline-editor/</link>
		<comments>http://www.jasperpotts.com/blog/2009/01/javafx-spline-editor/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 11:04:56 +0000</pubDate>
		<dc:creator>Jasper Potts</dc:creator>
				<category><![CDATA[JavaFX]]></category>
		<category><![CDATA[JavaFXApplications]]></category>

		<guid isPermaLink="false">http://www.jasperpotts.com/blog/2009/01/javafx-spline-editor/</guid>
		<description><![CDATA[When I was creating the prize draw application I needed to work out the Spline interpreter numbers to make the names thud down. I ended up using Romain Guy&#8217;s Spline Editor for Swing which makes it nice and easy. So thought it was about time we had a JavaFX version, and it could not be [...]]]></description>
			<content:encoded><![CDATA[<p>When I was creating the prize draw application I needed to work out the Spline interpreter numbers to make the names thud down. I ended up using <a href="http://www.jroller.com/gfx/entry/swing_demos_animations_and_swing">Romain Guy&#8217;s Spline Editor for Swing</a> which makes it nice and easy. So thought it was about time we had a JavaFX version, and it could not be too hard. So a couple hours and a couple hundred bind statements later we have a very cool little Spline Editor that lets you edit the spline and see the effect in real time then copy the code to paste into your JavaFX application.</p>
<p><img src="http://www.jasperpotts.com/blog/wp-content/uploads/2008/12/splineeditor.jpg" alt="Spline Editor" /></p>
<p>If you would like to try it for your self click here: <a href="http://jasperpotts.com/blogfiles/splineeditor/Spline_Editor.jnlp" onclick="javascript:urchinTracker ('/blogfiles/splineeditor/Spline_Editor.jnlp');" title="Launch Spline Editor" target="_blank"><img src="/blogfiles/launch.jpg" align="absmiddle" border="0" /></a> you can also download the <a href="http://jasperpotts.com/blogfiles/splineeditor/src.zip" onclick="javascript:urchinTracker ('/blogfiles/splineeditor/src.zip');" title="Spline Editor Src" target="_blank">source Netbeans project</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jasperpotts.com/blog/2009/01/javafx-spline-editor/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

