<?xml version="1.0" encoding="utf-8"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<title>Joshua Marinacci&apos;s Blog</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/" />
<modified>2008-07-16T22:34:17Z</modified>
<tagline></tagline>
<id>tag:weblogs.java.net,2008:/blog/joshy/73</id>
<generator url="http://www.movabletype.org/" version="3.01D">Movable Type</generator>
<copyright>Copyright (c) 2008, joshy</copyright>
<entry>
<title>OSCON and the JavaFX SDK</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/07/oscon_and_the_j.html" />
<modified>2008-07-16T22:34:17Z</modified>
<issued>2008-07-16T22:00:04Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.10126</id>
<created>2008-07-16T22:00:04Z</created>
<summary type="text/plain">We are now in the final push to get the first Preview Release of the JavaFX SDK out the door for the end of the month. I&apos;m excited by what we&apos;ve put together but also exhausted. We&apos;ve done an incredible...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>We are now in the final push to get the first Preview Release of the JavaFX SDK out the door for the end of the month. I'm excited by what we've put together but also exhausted. We've done an incredible amount of work during the last year. Now I know what it was like in the early days of Java. Since JavaOne 2007 we've built (from scratch), a compiler for a new language with many non-trivial features, a GUI runtime with a new graphics and animation stack, new netbeans plugins with code completion, utilities for graphic designers,  a new kind of javadocs (rewritten from the ground up), plus docs, samples, and demos.  And that's not even counting the many improvements that are going into JavaSE 6 update 10. Whew!  It's been a long year.
</p>

<p>We still have a lot to do before the final 1.0 release this fall, but we will have hit a huge milestone. Now all of the many pieces will be in one place so we can share it with you, get feedback, and improve performance and API design on the road to 1.0. 
</p>

<p>As part of the SDK kickoff, I'll be speaking at <a href="http://en.oreilly.com/oscon2008/public/content/home">OSCON</a> next week in Portland, Oregon (a scant 2 hour drive from my house!). My session is called "<a href="http://en.oreilly.com/oscon2008/public/schedule/detail/3128">Developers vs Designers: Expanding the Java Platform Beyond Programmers</a>". I will discuss how the Java platform is growing beyond market of corporate programmers to encompass designers, web 2.0 programmers, and eventually consumers themselves. And of course a super helping of demos. It's a good time to be involved with the client side Java ecosystem!
</p>


<p>If you will be there on Monday I will be doing a signing for my book Swing Hacks at 10am (i'm not sure of the location yet. next to the bookstore i think). I've been informed that all books at the bookstore will be 30% off. Plus, thanks to the magic of Oregon state law, <strong>there is no sales tax</strong>. If you attend also be sure to stop by the Sun booth. Sadly I won't be able to stay the whole week. I must leave Thursday morning which means I will miss the annual Oregon Brewfest.  Be sure to drink a pint for me.</p>

<p>PS. If you haven't registered yet you can get 15% off with the code <b>os08s15</b>.</p>







]]>

</content>
</entry>
<entry>
<title>JavaFX Innovations: Inline Examples and Screenshots</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/07/javafx_innovati.html" />
<modified>2008-07-03T21:18:26Z</modified>
<issued>2008-07-03T21:15:53Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.10072</id>
<created>2008-07-03T21:15:53Z</created>
<summary type="text/plain">One of the innovations in the JavaFX toolchain is our new javafxdoc tool. Rather than producing a set of html files like regular &apos;javadoc&apos; does, we produce a single large XML file representing the entire codebase&apos;s API. This lets us...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>
<dc:subject>Community: Java Tools</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>One of the innovations in the JavaFX toolchain is our new javafxdoc tool. Rather than producing a set of html files like regular 'javadoc' does, we produce a single large XML file representing the entire codebase's API. This lets us easily add extra processing steps, such as producing semantic wellformed XHTML as you see today.  It also lets us do a few other things. I think I've mentioned before the custom doclet tags for things like default value and read only attributes.  Now we've added inline examples.
</p>

<p>Before today if you wanted some example code with a screenshot in your docs you had to mark up the code manually (assuming you wanted any syntax highlighting), then copy the code into a separate project, compile it, run it, then save a screenshot of the running app. And finally you must copy the screenshot back into your docs. This system is really bad for several reasons:
</p>

<ul>
<li>It's time consuming, so we do less of it.</li>
<li>The repository becomes polluted with screenshots</li>
<li>The sample code may not compile if the API changes before you release the SDK</li>
<li>The screenshots can get quickly out of date</li>
<li>The code snippets aren't syntax highlighted</li>
</ul>

<h3>Inline Examples</h3>

<p>With our new inline examples system all of these are taken care of. Just use the @example doc tag and the rest is handled for you. The doc tool will compile and run your code into a buffered image. Then it will insert nicely syntax highlighted code back into the final page along with a link to the screenshot. 
</p>

<p>Here's an example:
</p>

<pre><code>@example
import javafx.scene.geometry.*;
import javafx.scene.paint.*;

ShapeSubtract {
    fill: Color.BLACK
    a: Rectangle { width: 100 height: 50 }
    b: Ellipse { centerX: 100 centerY: 25 radiusX: 50 radiusY: 25}
}
</code></pre>

<p>Will produce the page you see <a href="http://openjfx.java.sun.com/current-build/doc/api/javafx.scene.geometry/javafx.scene.geometry.ShapeSubtract.html">here</a>:</p>

<p>
<img src="http://weblogs.java.net/blog/joshy/fxdocs-inlineexamples-01.png" alt="fxdocs-inlineexamples-01.png" border="0" width="569" height="308" />

<br/>
<i>Live page <a href="http://openjfx.java.sun.com/current-build/doc/api/javafx.scene.geometry/javafx.scene.geometry.ShapeSubtract.html">here</a></i>
</p>

<p>That's it. No muss! No fuss. Everything is taken care of for you.
</p>

<h3>So what doesn't work?</h3>

<p>Well, there are a few rough edges still. Specifically:</p>

<ul>
<li>The syntax highlighting is very primitive. Essentially just a couple of quick regex's.</li>
<li>The text <code>the code:</code> and <code>produces:</code> are generated, rather than being text the author specifies.</li>
<li>There is no good way to know when the <code>@example</code> ends. For the time being I'm hacking it by marking the end with another doc tag <code>@endexample</code>.</li>
<li>You can't have nicely formatted and highlighted code without also getting a screenshot.</li>
<li>This won't work for non-graphics classes.</li>
<li>This won't work for animation.</li>
</ul>

<p>So there's still lots to do. In a future version I'd like to produce running applets rather than just screenshots, but I think that will have to wait until after the preview SDK. This is enough that we can get on with the task of writing great docs.
</p>

<p>Stay tuned for more documentation improvements in the future.</p>
]]>

</content>
</entry>
<entry>
<title>Java Doodle: fading translucent windows, on PC &amp; Mac</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/06/java_doodle_fad.html" />
<modified>2008-06-06T23:28:05Z</modified>
<issued>2008-06-06T23:05:11Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9936</id>
<created>2008-06-06T23:05:11Z</created>
<summary type="text/plain">This is the next in my series of Java Doodles. There is a link to my previous one in the references below. This time I&apos;m going to show you how to make a translucent window by setting the opacity value...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>This is the next in my series of Java Doodles.  There is a link to my previous one in the references below.  This time I'm going to show you how to make a translucent window by setting the opacity value using new apis in JavaSE 6 update 10. However, I'm also going to show you how to make it fade in when you mouse over it, similar to some popular chat applications, as well as <em>work properly on the Mac</em> and <em>degrade gracefully</em> when running versions of Java.
</p>

<h3>The basic idea</h3>

<p>Here is a screenshot of the basic app. It's a simple translucent window. I've you've read the recent <a href="http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/">SDN article</a> then you probably already know the basic APIs. This app will add Mac support, a rollover effect, and show you how to degrade gracefully.</p>

<p>
<img src="http://projects.joshy.org/demos/TranslucentWindow/screenshot.png"/>
<br/>
<i>Translucent Window</i>
</p>


<h3>Degrading gracefully</h3>
<p>Turning on translucency with Java SE 6 is as simple as calling a new private API: <code> com.sun.awt.AWTUtilities.setWindowOpacity(float)</code>. To make it degrade gracefully on older VMs we could test if the feature is supported using the <code>isTranslucencySupported()</code> method. However, this API will probably change in Java 7 (since it's currently in a non-public package) and of course it doesn't exist on older versions of Java.  If I want to compile this on an older VM (such as on my MacBook) then I simply can't call the API directly. Instead I'll use reflection and wrap it in a try catch block. I've created my own method called <code>setAlpha(float)</code> which will safely call the <code>setWindowOpacity()</code> method.


<pre><code>    private static void setAlpha(float alpha) {
        try {
            Window win = frame;
            //invoke AWTUtilities.setWindowOpacity(win, 0.0f);
            Class awtutil = Class.forName("com.sun.awt.AWTUtilities");
            Method setWindowOpaque = awtutil.getMethod("setWindowOpacity", Window.class, float.class);
            setWindowOpaque.invoke(null, win, (float)alpha);
        } catch (Exception ex) {
            //ex.printStackTrace();
        }
    }
</code></pre>

<p>Now, if the method doesn't exist at runtime because the user has an older version of Java then the exception will be caught and nothing will happen. It degrades gracefully.
</p>

<h3>Mac support</h3>

<p>So what about the Mac? Well, Mac OS X doesn't have a version of Java SE 6 update 10 yet, however in Leopard they did introduce a new API for doing translucency.  Using this new support we can add translucency on Mac with a single extra line. In the catch block above we can add this:
</p>

<pre><code>        } catch (Exception ex) {
            //ex.printStackTrace();
            frame.getRootPane().putClientProperty("Window.alpha", new Float(alpha));
        }
</code></pre>

<p>This sets a magic property on the rootpane of the frame called <code>Window.alpha</code>. Because this is a client property it will have no effect on other platforms that don't know about it. Again, degrading gracefully.
</p>

<h3>The fade effect</h3>

<p>Now that we can make a window translucent lets do something interesting with it. I want the window to be mostly transparent, but whenever the mouse moves into the window I want to return to mostly opaque. So let's say the opacity will go from 0.5 to 0.9. I could set a mouse listener on the background of th window, but that wouldn't work on subcomponents. I could also put in a glasspane to check for mouse events, but then I would have to redispatch all events back down to the real components as I did in my book <a href="http://oreilly.com/catalog/9780596009076/">Swing Hacks</a>.  Very messy. Fortunately, as of Java 5, we have an easier method: just poll the global mouse position using the <code>MouseInfo</code> class. Here's a <code>Runnable</code> which does that:</p>

<pre><code>    private static Runnable mouseWatcher = new Runnable() {

        public void run() {
            boolean previouslyInside = false;
            while (true) {
                try {
                    Thread.sleep(100);
                    Point pt = MouseInfo.getPointerInfo().getLocation();
                    boolean currentlyInside = frame.getBounds().contains(pt);
                    if (previouslyInside != currentlyInside) {
                        if (currentlyInside) {
                            setAlpha(0.9f);
                        } else {
                            setAlpha(0.5f);
                        }
                    }
                    previouslyInside = currentlyInside;

                } catch (InterruptedException ex) {
                    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    };
</code></pre>

<p>The code above will check the mouse position ten times a second. If the mouse has moved in or out of the window then it changes the opacity.  It's that simple.
</p>

<h3>Run the app</h3>

<p>You can try the live application here. It will work on MacOSX 10.5 or Windows/Solaris/Linux if you have a recent beta of JavaSE 6 update 10. On older versions of Java 6 you won't get the translucency effect, but the app will still run.
</p>

<p>
        <script src="http://java.com/js/deployJava.js"></script>
        <script>
            var url="http://projects.joshy.org/demos/TranslucentWindow/launch.jnlp";
            deployJava.createWebStartLaunchButton(url, "1.6");
        </script>
</p>



<p>That's all there is to it. This is just one of the many cool new features in JavaSE 6 update 10.  Go check'em out then come back to my blog for more Java Doodles in the future.</p>


<!-- AddThis Button BEGIN -->
<a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?wt=nw&pub=jmarinacci&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark and Share" target="_blank"><img src="http://s9.addthis.com/button1-addthis.gif" width="125" height="16" border="0" alt="Bookmark and Share" /></a>
<!-- AddThis Button END -->

<h3>References</h3>

<ul>

<li><a href="http://projects.joshy.org/demos/TranslucentWindow/TranslucentWindow.zip">source to the app</a></li>

<li>SDN article: <a href="http://java.sun.com/developer/technicalArticles/GUI/translucent_shaped_windows/"> How to Create Translucent and Shaped Windows</a></li>


<li><a href="http://download.java.net/jdk6/">JDK 6 update 10 b25</a></li>

<li><a href="http://developer.apple.com/technotes/tn2007/tn2196.html">new ui properties in Java for MacOSX Leopard</a></li>

<li><a href="http://oreilly.com/catalog/9780596009076/">Swing Hacks</a></li>

<li>previous doodle: <a href="http://weblogs.java.net/blog/joshy/archive/2008/05/java_doodle_cro.html">Java Doodle: crossdomain.xml Support</a></li>

</ul>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4461600-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>

]]>

</content>
</entry>
<entry>
<title>Java Doodle: crossdomain.xml Support</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/05/java_doodle_cro.html" />
<modified>2008-05-29T20:08:05Z</modified>
<issued>2008-05-28T21:59:55Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9878</id>
<created>2008-05-28T21:59:55Z</created>
<summary type="text/plain">While we wait for the full JavaFX SDK to be released later this summer I&apos;d like to show you some cool desktop Java things that you can do right now. This is the first in a series I&apos;m going to...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>While we wait for the full JavaFX SDK to be released later this summer I'd like to show you some cool desktop Java things that you can do <strong>right now</strong>. This is the first in a series I'm going to call Java Doodles, highlighting the new features in JavaSE 6 update 10, now in beta.  Join me over the coming weeks when we will explore more cool things you can do with desktop Java.
</p>

<h3>A photo applet</h3>
        <div id="applet">
            <applet code="photostrip.Applet"
                    archive="http://projects.joshy.org/demos/PhotoStrip/webstart/PhotoStrip.jar"
                    width="400" height="200"
                    >
                <param name="image" value="loadinfo.net.gif"/>
                <param name="boxmessage" value="loading..."/>
                <param name="boxborder" value="false"/>
                <param name="boxbgcolor" value="#ffffff"/>
                <param name="boxfgcolor" value="#000000"/>
                <param NAME="centerimage" VALUE="true">
                    
                <param name="jnlp_href" value="http://projects.joshy.org/demos/PhotoStrip/photostrip.jnlp">
                <param name="flickruser" value="31706743@N00"/>
                <param name="size" value="100"/>
                <param name="cols" value="4"/>
                <param name="rows" value="2"/>
            </applet>
        </div>

<p>Above is a simple applet which loads the most recent photos from my Flickr stream.  It's a very simple pure Java applet that's only 8k in size.  This applet isn't interesting for what it does, but rather what for what it <em>doesn't</em> do.  If you have JavaSE 6 update 10 then <strong>you won't see a security warning dialog</strong>, even though it's hosted on my personal server (not java.net) and it's connecting to Flickr.com.  How this this possible?
</p>


<p>The applet security model, known as the <em>sandbox</em>, only lets applets connect to the webserver they were loaded from. They cannot connect to anywhere else unless they are signed. Signing is great when you need access to more than what is allowed inside the sandbox, but it has two problems: the user will receive an ugly warning dialog about the applet, and the applet will have full access to the user's computer.  Full access is overkill when all you want to do is talk to a webservice on another server. Surely there is some middle ground between the sandbox and full access?  Well now there is.
</p>


<h3><code>crossdomain.xml</code> support</h3>

<p>If the server hosting a webservice has special xml file on it then the applet plugin will allow connections to that server.  This special file is called a <code>crossdomain.xml</code> file and it must be present on the exact subdomain hosting the webservice. <a href="http://static.flickr.com/crossdomain.xml">Here</a> is the <code>crossdomain.xml</code> file for the Flickr server hosting the images:</p>

<pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE cross-domain-policy SYSTEM &quot;http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd&quot;&gt;
&lt;cross-domain-policy&gt;
  &lt;allow-access-from domain=&quot;*&quot; /&gt;
&lt;/cross-domain-policy&gt;</code></pre>

<p>Because Flickr <i>wants</i> people to build apps which connect to their webservices they have put a crossdomain.xml file on all of their domains which host webservices. The <code>crossdomain.xml</code> mechanism was originally designed for Flash applications, but with JavaSE 6 update 10 now Java apps can take advantage of these services too!</p>


<h3>Degrading gracefully</h3>
<p>So what happens if you don't have update 10? In a plain applet the connection to static.flickr.com would throw a security access exception. The applet has to be signed for that to work, but we don't want the applet to be signed in the update 10 case.  The key to degrading gracefully is to have two sets of jars, one signed and the other unsigned, and use the new JNLP support to specify the update 10 version, falling back to the classic applet classpath for older JVMs.  Here's how it works.  In my webpage I put this applet tag:</p>

<pre><code>&lt;div id=&quot;applet&quot;&gt;
    &lt;applet code=&quot;photostrip.Applet&quot;
            <b>archive=&quot;http://projects.joshy.org/demos/PhotoStrip/webstart/PhotoStrip.jar&quot;</b>
            width=&quot;400&quot; height=&quot;200&quot;
            &gt;
        &lt;param name=&quot;jnlp_href&quot; value=&quot;http://projects.joshy.org/demos/PhotoStrip/photostrip.jnlp&quot;&gt;
        &lt;param name=&quot;flickruser&quot; value=&quot;31706743@N00&quot;/&gt;
        &lt;param name=&quot;size&quot; value=&quot;100&quot;/&gt;
        &lt;param name=&quot;cols&quot; value=&quot;4&quot;/&gt;
        &lt;param name=&quot;rows&quot; value=&quot;2&quot;/&gt;
    &lt;/applet&gt;
&lt;/div&gt;
</code></pre>

<p>then in the <code>photostrip.jnlp</code> file I put this</p>

<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;jnlp spec=&quot;1.0+&quot; codebase=&quot;&quot; href=&quot;&quot;&gt;
    &lt;information&gt;
        &lt;title&gt;PhotoStrip&lt;/title&gt;
        &lt;vendor&gt;Joshua Marinacci&lt;/vendor&gt;
        &lt;offline-allowed /&gt;
    &lt;/information&gt;
    &lt;resources&gt;
        &lt;j2se version=&quot;1.5+&quot; href=&quot;http://java.sun.com/products/autodl/j2se&quot; /&gt;
        <b>&lt;jar href=&quot;unsigned/PhotoStrip.jar&quot; main=&quot;true&quot; /&gt;</b>
        &lt;!-- Application Resources --&gt;
    &lt;/resources&gt;
  &lt;applet-desc 
      name=&quot;PhotoStrip&quot;
      main-class=&quot;photostrip.Applet&quot;
      width=&quot;400&quot;
      height=&quot;200&quot;&gt;
  &lt;/applet-desc&gt;
&lt;/jnlp&gt;</code></pre>


<p>The applet tag version uses the signed jar in the webstart directory. The JNLP version uses the unsigned jar in the unsigned directory. New JREs will use JNLP version without a warning dialog. Older JREs will use the applet tag version with the warning dialog. Using this simple method you can degrade gracefully in older JREs and browsers. In fact, you don't have to use this technique just for signing issues. The two jars could point to different versions of the app that turn on and off any of the other new JavaSE 6 update 10 features.
</p>

<h3>Going forward</h3>

<p>With <code>crossdomain.xml</code> support in Java now all sorts of mashups become possible in applets without any jar signing at all.  Here are a few other sites with crossdomain.xml supported webservices that you could connect to and do interesting things with.</p>

<ul>
<li><a href="http://twitter.com/">Twitter.com</a></li>
<li><a href="http://api.search.yahoo.com/">Yahoo</a></li>
<li><a href="http://www.youtube.com/">Youtube</a></li>
<li><a href="http://www.amazon.com/">Amazon</a></li>
<li><a href="http://musicbrainz.org/">MusicBrainz</a></li>
</ul>


<p>For more information on crossdomain.xml support in JavaSE 6 update 10 see these references:</p>

<ul>
<li><a href="https://jdk6.dev.java.net/plugin2/">JavaSE 6 update 10 plugin release notes</a></li>
<li><a href="http://static.flickr.com/crossdomain.xml">crossdomain.xml</a> on static.flickr.com</li>
<li><a href="http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html">Adobe's technote</a> on crossdomain.xml files</li>
<li><a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6676256">The Java bug report for adding crossdomain.xml support.
</a></li>
</ul>

<h3>Source</h3>
<p><a href="http://projects.joshy.org/demos/PhotoStrip/PhotoStrip.zip">Here is the source</a> to the PhotoStrip application. You also need <a href="http://projects.joshy.org/demos/PhotoStrip/bin.zip">this bin directory</a> which includes
some extra Ant tasks for packaging.</p>


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4461600-2");
pageTracker._initData();
pageTracker._trackPageview();
</script>
]]>

</content>
</entry>
<entry>
<title>JavaOne Exhaustion (with links!)</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/05/exhaustion_with.html" />
<modified>2008-05-19T21:49:01Z</modified>
<issued>2008-05-19T21:46:05Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9833</id>
<created>2008-05-19T21:46:05Z</created>
<summary type="text/plain">So another JavaOne has come to an end. This time I think I finally tried to simply do too much. I&apos;m lucky I didn&apos;t get the Moscone flu. Still, all in all, I think we had a good showing. I&apos;m...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>
<dc:subject>Community: JavaDesktop</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>So another JavaOne has come to an end. This time I think I finally tried to simply do too much. I'm lucky I didn't get the <a href="http://www.news.com/8301-13577_3-9940042-36.html">Moscone flu</a>.  Still, all in all, I think we had a good showing. I'm disappointed that the JavaFX SDK had to wait until July, but I'm glad we made the decision to put quality above meeting a conference deadline. Plus, there's a whole lot more to JavaFX than what's in the forthcoming SDK, which I'll discuss later this week.  I've also been collecting links and cool demos to feature on <a href="http://javafx.com/">our new website</a>. You'll see some of them go up in the following months.
</p>

<p>The video blogging went well. We even got an interview with <a href="http://weblogs.java.net/blog/fabriziogiudici/">Fabrizio Giudici</a> in both english and italian (fortunately Rachel Hill, our video blogger, knows italian).  I simply said "grazie". Look for this interview and more coming up soon in <a href="http://weblogs.java.net/blog/rachelhill/">Rachel's blog</a>.</p>


<p>Joshua Smith, a nice guy I met in the pavilion, has been working on some cool JavaFX demos that he showed in his session. <a href="http://java.sun.com/javaone/sf/2008/articles/javafxsexy.jsp">Here's an article about his demos.</a>
</p>

<p>A shout out to <a href="http://today.java.net/pub/au/88">Bruno</a>. I'm sorry I forgot to ask before using your picture in the Connected Life demo. I promise to create fake friends for my fake user in the future. :)
</p>

<p>JavaFX is getting favorable coverage in the news, 
<a href="http://www.news.com/8301-13953_3-9937054-80.html?tag=bl">here</a>,
<a href="http://blogs.zdnet.com/Stewart/?p=834">here</a>,
<a href="http://news.zdnet.com/2422-13568_22-200366.html?tag=nl.e539">here (video)</a>,
and from RedMonk <a href="http://www.redmonk.com/cote/2008/05/06/a-roadmap-for-javafx-adobes-beat-them-by-a-week-but-so-what-javaone-2008/">here
</a>,
all despite my demo crashing.
</p>

<p>By the way, I'd like to state for the record that my demo really did crash due to network congestion in Moscone. Or rather, there was a race condition in my (Java) threading code which only became a problem when the network is slow. That's why my demo ran fine a few hours earlier when Moscone was empty. Most importantly, the new Java browser plugin did <strong>exactly what it was supposed to do</strong>.  When my app seg-faulted it didn't take down the browser. We just hit the refresh button and the applet came back. That's the strength of our new plugin and it makes all sorts of things possible. I have since rewritten the offending code in my demo so you can expect to see a live version of it later.
</p>

<p>In other news, there's been a lot of interesting discussion about what an RIA is and if it makes sense at all (vs. pure thin solutions like AJAX).  Check out my discussion on the JavaOne Pavilion floor with Hani, Carlos, and Pete.
</p>

<p>
<object type="application/x-shockwave-flash" data="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&feedurl=http%3A%2F%2Fraeandkcreative%2Eblip%2Etv%2Frss&file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F911093%3Freferrer%3Dblip%2Etv%26source%3D1&showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" width="400" height="255" allowfullscreen="true" id="showplayer"><param name="movie" value="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&feedurl=http%3A%2F%2Fraeandkcreative%2Eblip%2Etv%2Frss&file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F911093%3Freferrer%3Dblip%2Etv%26source%3D1&showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" /><param name="quality" value="best" /><embed src="http://blip.tv/scripts/flash/showplayer.swf?enablejs=true&feedurl=http%3A%2F%2Fraeandkcreative%2Eblip%2Etv%2Frss&file=http%3A%2F%2Fblip%2Etv%2Frss%2Fflash%2F911093%3Freferrer%3Dblip%2Etv%26source%3D1&showplayerpath=http%3A%2F%2Fblip%2Etv%2Fscripts%2Fflash%2Fshowplayer%2Eswf" quality="best" width="400" height="255" name="showplayer" type="application/x-shockwave-flash"></embed></object></p>


<p>Well, that's it for now. I've noticed some confusion about JavaFX and it's availability, so look for some more info from me later this week.  See you soon.</p>





]]>

</content>
</entry>
<entry>
<title>JavaOne video blogs with Rachel Hill</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/05/javaone_video_b.html" />
<modified>2008-05-07T07:09:46Z</modified>
<issued>2008-05-07T07:09:41Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9724</id>
<created>2008-05-07T07:09:41Z</created>
<summary type="text/plain">My first two video blogs with Rachel Hill are up. The first is a sneak peek of what&apos;s coming during my demo prep. The second is some excerpts from this mornings keynote, including the t-shirt hurling and Neil Young&apos;s Blu-Ray...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>My first two video blogs with Rachel Hill are up. The first is <a href="http://weblogs.java.net/blog/rachelhill/archive/2008/05/javaone_sneak_p.html">a sneak peek of what's coming</a> during my demo prep. The second is some <a href="http://weblogs.java.net/blog/rachelhill/archive/2008/05/javaone_2008_ge_1.html">excerpts from this mornings keynote</a>, including the t-shirt hurling and Neil Young's Blu-Ray disk.</p>

<p>Stay tuned for more JavaOne excitement.</p>






]]>

</content>
</entry>
<entry>
<title>JavaFX.com</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/05/javafxcom.html" />
<modified>2008-05-07T07:00:56Z</modified>
<issued>2008-05-07T06:59:25Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9723</id>
<created>2008-05-07T06:59:25Z</created>
<summary type="text/plain">We launched JavaFX.com today. I&apos;m very excited about this site since I was personally involved in putting it together. We have videos of the JavaFX demos from each keynote as well as explanations of what JavaFX is, where you can...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>We launched <a href="http://javafx.com/htdocs/index.html">JavaFX.com</a> today. I'm very excited about this site since I was personally involved in putting it together. We have videos of the JavaFX demos from each keynote as well as explanations of what JavaFX is, where you can get more info, and a signup page to get the SDK when it's ready.  </p>

<p>Okay, back into the fray. I'll see you tomorrow</p>]]>

</content>
</entry>
<entry>
<title>My keynote demo</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/05/my_keynote_demo.html" />
<modified>2008-05-07T00:09:09Z</modified>
<issued>2008-05-07T00:09:03Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9715</id>
<created>2008-05-07T00:09:03Z</created>
<summary type="text/plain">Well, the initial showing didn&apos;t go so well. The main parts worked but it crashed twice on stage when my boss demoed it. When we showed it again this afternoon and added Jabber support live, everything worked beautifully. I guess...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>Well, the initial showing didn't go so well. The main parts worked but it crashed twice on stage when my boss demoed it.  When we showed it again this afternoon and added Jabber support live, everything worked beautifully. I guess the demo gods were happy the second time around.
</p>

<p>
<a href="http://www.flickr.com/photos/31706743@N00/2471538519" title="View 'DSC_1409.JPG' on Flickr.com"><img src="http://farm3.static.flickr.com/2065/2471538519_1691e6665d.jpg" alt="DSC_1409.JPG" border="0" width="500" height="332" /></a>
</p>]]>

</content>
</entry>
<entry>
<title>Hear me on RIA Weekly</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/04/hear_me_on_ria.html" />
<modified>2008-05-01T06:01:46Z</modified>
<issued>2008-05-01T06:01:33Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9650</id>
<created>2008-05-01T06:01:33Z</created>
<summary type="text/plain">I almost forgot in the rush up to JavaOne that I recently appeared (is that possible in an audio only podcast?) in lucky episode 13 of the RIA weekly. RIA Weekly is a podcast by Michael Cote of RedMonk and...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>I almost forgot in the rush up to JavaOne that I recently appeared (is that possible in an audio only podcast?) in lucky episode 13 of the RIA weekly.  RIA Weekly is a podcast by Michael Cote of RedMonk and Ryan Stewart of Adobe. I talked about JavaOne, our general goals for JavaFX, how the pieces of JavaFX came together, and what it's like working on designer tools.
</p>

<p>You can read the episode synopsis <a href="http://www.redmonk.com/cote/2008/04/17/ria-weekly-013-javafx-with-joshua-marinacci-widgets-curl-drm-and-the-adobe-media-player/">here</a> or download <a href="http://media.libsyn.com/media/redmonk/riaweekly013.mp3">the mp3 here</a>. If you like the episode be sure to subscribe to <a href="http://feeds.feedburner.com/riaweekly">the full RIA Weekly feed in iTunes</a>.
</p>]]>

</content>
</entry>
<entry>
<title>JavaOne is like Christmas</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/04/javaone_is_like.html" />
<modified>2008-04-20T23:06:35Z</modified>
<issued>2008-04-19T16:33:29Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9569</id>
<created>2008-04-19T16:33:29Z</created>
<summary type="text/plain">You may be wondering why I haven&apos;t blogged recently, or why some of the JavaFX lists have died down, or more generally just what the heck we are all doing these days. Well, there&apos;s something you need to understand: JavaOne...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>You may be wondering why I haven't blogged recently, or why some of the JavaFX lists have died down, or more generally just what the heck we are all doing these days.  Well, there's something you need to understand:
</p>

<h3>JavaOne is like Christmas</h3>

<p>I do not mean 'like Christmas' in the kid sense of 'waking up and going downstairs to open presents'.  Well, it is, but that's for you guys who watch or attend JavaOne.  I mean JavaOne is 'like Christmas' in the sense of rushing around for two months before the big day. We plan, shop, wrap, prepare, cook, and travel in our mad but exciting efforts to put together a great event for you (even if you won't be there in person).
</p>

<p>We have some really cool stuff in store. I just spent a few days down in LA with Chris Oliver and Ant working on some really great demos. Then there's articles, tutorials, samples, and much much more. Oh, and I have to finish my slides in there somewhere.  The days before JavaOne are truly a colossal effort, but it's worth it when the big week arrives.
</p>

<p>So when someone asks where we all are I'll just say: getting ready for Christmas.</p>
]]>

</content>
</entry>
<entry>
<title>At the speed of JavaFX</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/04/at_the_speed_of.html" />
<modified>2008-04-06T19:20:09Z</modified>
<issued>2008-04-06T19:19:58Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9486</id>
<created>2008-04-06T19:19:58Z</created>
<summary type="text/plain">As we all rush headlong into JavaOne prep someone (okay it was James Gosling) sent me an email about performance of JavaFX. Speed is a crucial issue for anything dealing with user interfaces, so we care deeply about performance in...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>As we all rush headlong into JavaOne prep someone (okay it was James Gosling) sent me an email about performance of JavaFX.  Speed is a crucial issue for anything dealing with user interfaces, so we care deeply about performance in our work with JavaFX. On the other hand we are focusing on bug fixes and correctness right now, not optimization, so it's not as fast as it could be.
</p>

<p>So how do we fare?  
</p>

<p>Well, as a rough measurement, since there aren't any real benchmarks yet for rich internet applications, we have been using a website called <a href="http://bubblemark.com/">BubbleMark</a>, which has a simple graphics application written in many different languages/runtimes. It's the closest thing we have to a cross platform bench mark.
</p>

<p>So, how do we fare?
</p>

<p>James had this to say: "I just tried it on a MacPro running JDK6(developer preview 10) and the swing version runs at 198 fps with 32 balls, and the JavaFX version runs at <strong>186</strong> fps.  Flex (cached) ran at <strong>58</strong>...".</p>

<p>So JavaFX's graphics layer, built on the currently un-optimized SceneGraph library, is only a few percentage points behind the plain Java2D/Swing version, and they are both <strong>3 to 4 times faster than the Flex version</strong>. Not bad!</p>




]]>

</content>
</entry>
<entry>
<title>Back from Australia</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/04/back_from_austr.html" />
<modified>2008-04-06T02:15:30Z</modified>
<issued>2008-04-06T02:15:18Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9483</id>
<created>2008-04-06T02:15:18Z</created>
<summary type="text/plain">Okay, so I&apos;ve actually been back for several weeks, but JavaOne stuff has kept me super busy. I had a simply awesome time in Syndey. It&apos;s really a great city to visit. Very clean and friendly. And some truly excellent...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>Okay, so I've actually been back for several weeks, but JavaOne stuff has kept me super busy.
</p>

<p>I had a simply awesome time in Syndey. It's really a great city to visit. Very clean and friendly. And some truly excellent coffee. If you ever go be sure to order a <a href="http://en.wikipedia.org/wiki/Flat_white">flat white</a>.</p>

<p>I was in Australia for the Sydney Tech Days, speaking on JavaFX. While there I also gave a short presentation on Dynamic Languages for the JVM to several local universities. My focus was on Ruby, JavaScript, Groovy, and JavaFX Script. I specifically left out Jython because it was not being supported very well and looked like it might die.  Of course, literally a day after I said this Sun announced that we are hiring two of the main Jython guys and it will be very well supported from now on. So I'm already out of date. Such is the life of a traveler.</p>


<p>While in Sydney I also did an interview with David Coldrick on JavaFX and the state of desktop Java. You can see my interview at Youtube below
or watch the super high-res version <a href="http://mediacast.sun.com/users/cindo/media/SunTechDays-Sydney-Epilogue.mp4/details">here</a></p>

<p>
<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/h1YDGKwZ4Zg&hl=en"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/h1YDGKwZ4Zg&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
</p>


<p>Oh, and enjoy a few photos from the zoo and aquarium.</p>

<!-- Start of Flickr Badge -->
<style type="text/css">
#flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;}
#flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;}
#flickr_icon_td {padding:0 5px 0 0 !important;}
.flickr_badge_image {text-align:center !important;}
.flickr_badge_image img {border: 1px solid black !important;}
#flickr_www {display:block; text-align:left; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;}
#flickr_badge_uber_wrapper a:hover,
#flickr_badge_uber_wrapper a:link,
#flickr_badge_uber_wrapper a:active,
#flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;}
#flickr_badge_wrapper {background-color:#CCCCCC;border: solid 1px #000000}
#flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;}
</style>
<table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"><tr><td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper">
<tr>
<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&count=5&display=random&size=t&layout=h&source=user_set&user=31706743%40N00&set=72157604111863668&context=in%2Fset-72157604111863668%2F"></script>
<td id="flickr_badge_source" valign="center" align="center">
<table cellpadding="0" cellspacing="0" border="0"><tr>
<td width="10" id="flickr_icon_td"><a href="http://www.flickr.com/photos/joshyx/sets/72157604111863668/"><img id="flickr_badge_icon" alt="Joshua Marinacci's Sydney 2008 photoset" src="http://farm1.static.flickr.com/60/buddyicons/31706743@N00.jpg?1184425730#31706743@N00" align="left" width="48" height="48"></a></td>
<td id="flickr_badge_source_txt">Joshua Marinacci's <a href="http://www.flickr.com/photos/joshyx/sets/72157604111863668/">Sydney 2008</a> photoset</td>
</tr></table>
</td>
</tr>
</table>
</td></tr></table>
<!-- End of Flickr Badge -->


]]>

</content>
</entry>
<entry>
<title>Bleg: do you know of any good forum software?</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/03/bleg_do_you_kno.html" />
<modified>2008-03-29T21:10:52Z</modified>
<issued>2008-03-29T21:10:46Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9441</id>
<created>2008-03-29T21:10:46Z</created>
<summary type="text/plain">Today I think I shall use the power of my blog for evil instead of good. Well, maybe not evil but at least for my own personal gain. I need some forum software. After searching online for an hour or...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>Today I think I shall use the power of my blog for evil instead of good. Well, maybe not evil but at least for my own personal gain. 
</p>

<p>I need some forum software. After searching online for an hour or so and asking a few friends the consensus seems to be <a href="http://www.phpbb.com/">phpbb</a>. Is this really the best of the bunch? The many forum software packages I have found all leave a great deal to be desired. They are often ugly, have extra features I don't need, are missing a few crucial features that I do need, and seem to have a plethora of config options.  Surely there is something good out there I'm missing.  So my question to you is: what forum software do you recommend?
</p>

<p>Here are my constraints:
</p>


<ul>
<li>the UI must be skinnable
</li>
<li>it must have true email support, where some readers can read and post via email and some readers can read and post via the website. 
</li>
<li>it must be open source or at least free for commercial use (though i'm not averse to purchasing a support contract after evaluation)
</li>
<li>Being written in Java is desired but not essential. As long as it runs on Linux or Solaris I'm fine.
</li>
</ul>

<p>Any ideas?</p>

<p>Thanks.<br/>
&nbsp;&nbsp;Josh</p>]]>

</content>
</entry>
<entry>
<title>You need at least 386 Power</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/03/you_need_at_lea.html" />
<modified>2008-03-18T17:01:30Z</modified>
<issued>2008-03-18T17:01:23Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9384</id>
<created>2008-03-18T17:01:23Z</created>
<summary type="text/plain">This is some old videos from the early days of the internet. And by videos I mean VHS. Videos from the mid 1990s that taught you about what the internet is and how to use it. Check out the screenshots...</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>

<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<p>This is some old videos from the early days of the internet. And by videos I mean VHS.  Videos from the mid 1990s that taught you about what the internet is and how to use it.  Check out the screenshots of Yahoo circa 1995 and the mention of Gopher.</p>

<p><a href="http://www.waxy.org/archive/2008/03/17/internet.shtml">Internet Power, Volume 1: Flashback to the VHS-Era Web</a></p>

<p>I recall trying to explain the internet to friends and family back then and had trouble describing the scale of it. 
</p>

<blockquote>
Me: It sends files.<br/>
Them: so it's like a fax machine?<br/>
Me: it sends email.<br/>
Them: So it's like the postal system?<br/>
Me: It finds things.<br/>
Them: So it's like a phone book?<br/>
Me: Gaaah!<br/>
Them: I don't see what the big deal is.<br/>
</blockquote>

<p>Of course we now know the Internet is all of those things and more, fundamentally changing the way everything is done. Now I could summarize it as: <em>The Internet is the new electricity.</em> </p>]]>

</content>
</entry>
<entry>
<title>JavaFX Doodle #3: A Paper Cutout Demo</title>
<link rel="alternate" type="text/html" href="http://weblogs.java.net/blog/joshy/archive/2008/03/javafx_doodle_3.html" />
<modified>2008-03-27T21:03:47Z</modified>
<issued>2008-03-14T00:27:24Z</issued>
<id>tag:weblogs.java.net,2008:/blog/joshy/73.9361</id>
<created>2008-03-14T00:27:24Z</created>
<summary type="text/plain"> I just flew back from Australia where I spoke at the Sydney tech days and boy are my arms tired. Actually, it&apos;s more my legs than my arms, and technically I arrived before I left which is pretty weird......</summary>
<author>
<name>joshy</name>

<email>joshy@joshy.org</email>
</author>
<dc:subject>Community: JavaDesktop</dc:subject>
<content type="text/html" mode="escaped" xml:lang="en" xml:base="http://weblogs.java.net/blog/joshy/">
<![CDATA[<!--extractstart-->
<p>I just flew back from Australia where I spoke at the Sydney tech days and boy are my arms tired. Actually, it's more my legs than my arms, and technically I arrived before I left which is pretty weird... but anyway, I'm back now. I'm exhausted and don't have my photos in order yet so the Sydney post will have to wait until next week.  For now, however, I thought I'd share with you Doodle #3, which is one of the demos I showed in Sydney.  
</p>

<p>A Paper Cutout is a style of application common in the Flash world.  It has a character of some sort with a bunch of pieces of clothing or other accessories next to it.  You can think of it as the modern equivalent of a paper doll or Mr. Potato head.  One of my favorites it the <a href="http://www.sp-studio.de/">South Park character builder</a>.  You can run my humble little version of it <a href="http://projects.joshy.org/demos/javafx/Doodle3_Cutout/">here</a>.  
</p>

<p><img src="http://projects.joshy.org/demos/javafx/Doodle3_Cutout/screenshot.png"/><br/>
<i>Paper Cutout: <a href="http://projects.joshy.org/demos/javafx/Doodle3_Cutout/">run it</a></i>
</p>


<p>I built this demo in about an hour. I spent 10 minutes writing the code and 50 minutes badly drawing the artwork in Photoshop. When you run the demo you can move the pieces around and drop them on the canvas.  Notice the drop shadow below the piece when you drag it.  The code to do this is very simple. Each of the pieces is just a PNG image drawn in Photoshop. To add the movement I subclassed  <code>ImageView</code> to create the <code>Cutout</code> class.
</p>


<pre><code>class Cutout extends ImageView {
    attribute x: Number;
    attribute y: Number;
    attribute url: String;
    attribute movable: Boolean;
}

attribute Cutout.movable = true;
attribute Cutout.image = Image { url: bind url };
attribute Cutout.transform = bind translate(x,y);
</code></pre>


<p>The code above is pretty straight forward. The subclass adds <code>x</code> and <code>y</code> attributes which are bound to the <code>transform</code>, meaning the transform will update whenever the x or y coordinate changes.  The <code>image</code> is bound to the <code>url</code>, so when you set the <code>url</code> attribute the real image will be loaded automatically.  Now we just need some event handlers:
</p>


<pre><code>attribute Cutout.onMousePressed = operation(e:CanvasMouseEvent) {
    this.filter = ShadowFilter { distance: 10, radius: 10, opacity: 0.7 };
};
attribute Cutout.onMouseReleased  = operation(e:CanvasMouseEvent) {
    this.filter = null;
};
attribute Cutout.onMouseDragged = operation(e:CanvasMouseEvent) {
    if(movable) {
        this.x += e.dragTranslation.x;
        this.y += e.dragTranslation.y;
    }
};</code></pre>

<p>When the mouse is pressed it will turn on a shadow filter. When the mouse is released it will turn the shadow off.  When you drag the mouse it will update the <code>x</code> and <code>y</code> attributes. The JavaFX API saves you from the pain of coordinate conversion by providing a pre-converted dragTranslation point. Just add it to the <code>x</code> and <code>y</code> attributes and you are off to go. Notice the <code>if(movable)</code> test. This is to turn off dragging if necessary, which is required for the image of the main character in the code below.
</p>

<p>Now just combine them in a <code>MainCanvas</code> group and you are done.</p>

<pre><code>class MainCanvas extends CompositeNode {  }
operation MainCanvas.composeNode() {
    return Group {
        transform: [translate(50,60)],
        content:  [
            Cutout { x: 200, y: 0, url: "paperdoll/frog.png", movable: false  },
            Cutout { x: 5, y: 0, url: "paperdoll/hat.png" },
            Cutout { x: 5, y: 80, url: "paperdoll/patch.png" },
            Cutout { x: 5, y: 140, url: "paperdoll/moustache.png" },
            Cutout { x: 40, y: 190, url: "paperdoll/goatee.png" },
            ]
    };
}</code></pre>

<p>So that's doodle number three. Almost entirely declarative and quite simple. See you next week.
</p>
<p>&nbsp;&nbsp;&nbsp;- Josh
</p>

<h3>Resources</h3>
<ul>
<li><a href="http://projects.joshy.org/demos/javafx/Doodle3_Cutout/PaperDoll.zip">NetBeans project</a></li>
<li><a href="http://projects.joshy.org/demos/javafx/Doodle3_Cutout/">Java Webstart link</a></li>
</ul>

<!--extractend-->]]>

</content>
</entry>

</feed>