<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7248575739629511717</id><updated>2012-01-18T00:33:57.841-08:00</updated><category term='MVN'/><category term='flash'/><category term='web'/><category term='Baby Got Back'/><category term='javafxString'/><category term='10.6.4'/><category term='CoreServices'/><category term='Dave'/><category term='syntax'/><category term='Fuller'/><category term='dtfx.js'/><category term='mouse'/><category term='Kubuntu'/><category term='highlighter'/><category term='function'/><category term='drag'/><category term='Mac'/><category term='Lazy'/><category term='Mac OS X'/><category term='10.6.3'/><category term='SyntaxHighlighter'/><category term='scrollable'/><category term='Pac-Man JavaFX 2 2.0 Java Mac OS X Applet Web Start JNLP GitHub Source Code Henry Zhang NetBeans PacMan Arcade Game'/><category term='bind'/><category term='JFreeChart'/><category term='System'/><category term='10.6.6'/><category term='java'/><category term='slow'/><category term='delayed'/><category term='dragging'/><category term='Bush'/><category term='Zoomable'/><category term='format'/><category term='JFrame'/><category term='setContentPane'/><category term='regular expression'/><category term='Blogger'/><category term='Brush'/><category term='page'/><category term='libnpjp2.so'/><category term='Firefox'/><category term='Intrepid'/><category term='Upgrade'/><category term='10.6.5'/><category term='Eclipse'/><category term='JXLayer'/><category term='wheel'/><category term='scroll'/><category term='Sir Mix-a-Lot'/><category term='Load'/><category term='getElementById'/><category term='Intel'/><category term='pre'/><category term='Xubuntu'/><category term='Demo'/><category term='Xfce'/><category term='2.2.1'/><category term='32-Bit'/><category term='web start'/><category term='javascript'/><category term='Explorer'/><category term='add'/><category term='JNLP'/><category term='blank'/><category term='galternatives'/><category term='Gilbert'/><category term='transforms'/><category term='template'/><category term='Leopard'/><category term='OS X'/><category term='Landon'/><category term='Swing'/><category term='pivotX'/><category term='zoom'/><category term='update 10'/><category term='plugin'/><category term='keyword'/><category term='browser'/><category term='10.6'/><category term='2.2.0'/><category term='script'/><category term='code'/><category term='Terminal'/><category term='Applications'/><category term='Application'/><category term='update'/><category term='manual'/><category term='share'/><category term='G Alternatives'/><category term='innerHTML'/><category term='Magnifier'/><category term='Internet'/><category term='scale'/><category term='SoyLatte'/><category term='update-alternatives'/><category term='highlight'/><category term='3.0.2'/><category term='Update 4'/><category term='Library'/><category term='10.5'/><category term='button'/><category term='Snow Leopard'/><category term='tar'/><category term='time'/><category term='JavaFX'/><category term='source'/><category term='3.0.1'/><category term='Install'/><category term='Maven'/><category term='generics'/><category term='Linux'/><category term='div'/><category term='3.0'/><category term='Ubuntu'/><category term='clipboard'/><category term='Scalable'/><category term='pivotY'/><category term='usr'/><category term='Applet'/><category term='Utilities'/><title type='text'>Blogona and Cheese</title><subtitle type='html'>(Hold the Cheese)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-7046869263080557555</id><published>2011-10-13T01:57:00.000-07:00</published><updated>2012-01-18T00:33:57.869-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pac-Man JavaFX 2 2.0 Java Mac OS X Applet Web Start JNLP GitHub Source Code Henry Zhang NetBeans PacMan Arcade Game'/><title type='text'>Pac-Man in JavaFX 2</title><content type='html'>&lt;a href="http://www.oracle.com/technetwork/java/javafx/downloads/index.html" target="_new"&gt;JavaFX 2 Beta&lt;/a&gt; was FINALLY released for Mac OS X. I thought I would learn it by porting one of my favorite JavaFX 1 games: Pac-Man! The original code was written by Henry Zhang. He wrote a five-part series of articles (&lt;a href="http://www.developria.com/2009/05/writing-the-pac-man-game-in-ja.html" target="_new"&gt;Part 1&lt;/a&gt;,
&lt;a href="http://www.developria.com/2009/05/writing-the-pac-man-game-in-ja-1.html" target="_new"&gt;Part 2&lt;/a&gt;,
&lt;a href="http://www.developria.com/2009/05/writing-the-pac-man-game-in-ja-2.html" target="_new"&gt;Part 3&lt;/a&gt;,
&lt;a href="http://www.developria.com/2009/06/writing-the-pac-man-game-in-ja-3.html" target="_new"&gt;Part 4&lt;/a&gt;,
&lt;a href="http://www.developria.com/2009/06/writing-the-pac-man-game-in-ja-4.html" target="_new"&gt;Part 5&lt;/a&gt;) explaining the design of the game. He also wrote a neat &lt;a href="http://www.javafxgame.com/pac-man-widget-for-widgetfx-12/" target="_new"&gt;widget&lt;/a&gt; for the game.
&lt;br /&gt;
&lt;br /&gt;
I ported the original JavaFX 1 code to JavaFX 2 using the Java SE bundle of &lt;a href="http://download.netbeans.org/netbeans/7.1/beta/" target="_new"&gt;Netbeans 7.1 Beta&lt;/a&gt; on my MacBook. If you want to play the game on a Mac you can install the &lt;a href="http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html" target="_new"&gt;SDK and samples&lt;/a&gt;, download my &lt;a href="http://java2014.appspot.com/fx2/pacman.jar" target="_new"&gt;JAR file&lt;/a&gt;, and place it in your samples folder. Double-click the &lt;code&gt;pacman.jar&lt;/code&gt; file from within the &lt;code&gt;javafx-samples-2.0&lt;/code&gt; folder to launch the game. Make sure you install the samples according to the instructions &lt;a href="http://download.oracle.com/javafx/2.0/release_notes_mac/jfxpub-release_notes_mac.htm" target="_new"&gt;here&lt;/a&gt;.
&lt;br /&gt;
&lt;br /&gt;
If you are on Windows, you will need to have &lt;a href="http://www.java.com/getjava/" target="_new"&gt;Java SE 6&lt;/a&gt; Update 26 or later and the &lt;a href="http://java.com/javafx" target="_new"&gt;JavaFX 2 runtime&lt;/a&gt; installed. If everything is installed correctly, you can &lt;a href='http://java2014.appspot.com/fx2/pacman.jnlp' onclick="return launchApplication('http://java2014.appspot.com/fx2/pacman.jnlp');"&gt;click here to launch Pac-Man in Java Web Start&lt;/a&gt;. Or you can play in the applet below. If JavaFX 2 is not installed correctly, you will see an image asking you to install JavaFX rather than a working applet. 
&lt;br /&gt;
&lt;br /&gt;

&lt;SCRIPT src="http://java2014.appspot.com/fx2/web-files/dtjava.js"&gt;&lt;/SCRIPT&gt;
 &lt;script&gt;
     function launchApplication(jnlpfile) {
         dtjava.launch(            {
                 url : 'http://java2014.appspot.com/fx2/pacman.jnlp',
             },
             {
                 javafx : '2.0+'
             },
             {}
         );
         return false;
     }
 &lt;/script&gt;

 &lt;script&gt;
     function javafxEmbed_fxApp() {
         dtjava.embed(
             {
                 id : 'fxApp',
                 url : 'http://java2014.appspot.com/fx2/pacman.jnlp',
                 placeholder : 'javafx-app-placeholder',
                 width : 528,
                 height : 544,
             },
             {
                 javafx : '2.0+'
             },
             {}
         );
     }
     &lt;!-- Embed FX application into web page once page is loaded --&gt;
     dtjava.addOnloadCallback(javafxEmbed_fxApp);
 &lt;/script&gt;

  &lt;!-- Applet will be inserted here --&gt;
  &lt;div id='javafx-app-placeholder'&gt;&lt;/div&gt;

&lt;br /&gt;
I can post the source code here or put it on GitHub if anyone is interested. Right now, the code is a bit messy. It still has all of Henry Zhang's original JavaFX 1 code commented-out inline with the new JavaFX 2 code. Enjoy the game!
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-7046869263080557555?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/7046869263080557555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2011/10/pac-man-in-javafx-2.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7046869263080557555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7046869263080557555'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2011/10/pac-man-in-javafx-2.html' title='Pac-Man in JavaFX 2'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-1719846194747156026</id><published>2011-01-17T22:29:00.000-08:00</published><updated>2011-01-17T22:51:17.962-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='Snow Leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='share'/><category scheme='http://www.blogger.com/atom/ns#' term='usr'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.5'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.6'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0.1'/><category scheme='http://www.blogger.com/atom/ns#' term='MVN'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6'/><category scheme='http://www.blogger.com/atom/ns#' term='Install'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0.2'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Maven'/><category scheme='http://www.blogger.com/atom/ns#' term='manual'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='Upgrade'/><title type='text'>Updating to Maven 3.0.2 in Mac OS X Snow Leopard</title><content type='html'>Mac OS X 10.6.6 ships with Maven 2.2.0 installed. Invoking Maven from the Terminal with the &lt;span class="code"&gt;mvn -v&lt;/span&gt; command produces the following output:
&lt;br /&gt;
&lt;pre&gt;
  bash-3.2# mvn -v
  Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
  Java version: 1.6.0_22
  Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.6.6" arch: "i386" Family: "mac"
&lt;/pre&gt;
To manually upgrade to Maven 3.0.2, complete these 3 steps:
&lt;ol&gt;
&lt;li&gt;Download Maven 3 archive&lt;/li&gt;
&lt;li&gt;Unpack archive into /usr/share/java/&lt;/li&gt;
&lt;li&gt;Link /usr/share/maven to /usr/share/java/apache-maven-3.0.2&lt;/li&gt;
&lt;/ol&gt;
Below are the details of each step.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
1. Download Maven 3 archive
&lt;/span&gt;
&lt;br /&gt;
Go to the &lt;a href="http://maven.apache.org/download.html" target="_new"&gt;Maven download site&lt;/a&gt; and download the file named &amp;#147apache-maven-3.0.2-bin.tar.gz&amp;#148 to your Desktop.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
2. Unpack archive into /usr/share/java/
&lt;/span&gt;
&lt;br /&gt;
Open the Terminal. You will need root access to install Maven. Type the following to open a root shell:
&lt;pre&gt;  sudo bash&lt;/pre&gt;
Type your administrator password if prompted. Copy the file that you downloaded in step 1 to the directory where the new Maven will be installed by typing this command:
&lt;pre&gt;  cp ~/Desktop/apache-maven-3.0.2-bin.tar.gz /usr/share/java/&lt;/pre&gt;
Change to the installation directory by entering this command:
&lt;pre&gt;  cd /usr/share/java/&lt;/pre&gt;
Unpack the archive, which will create a new directory called &lt;span class="code"&gt;apache-maven-3.0.2&lt;/span&gt;:
&lt;pre&gt;  tar xzf apache-maven-3.0.2-bin.tar.gz&lt;/pre&gt;
Remove the archive file - it is no longer needed:
&lt;pre&gt;  rm apache-maven-3.0.2-bin.tar.gz&lt;/pre&gt;
Remove quarantine status from trusted Maven installation files:
&lt;pre&gt;  xattr -dr com.apple.quarantine apache-maven-3.0.2/&lt;/pre&gt;
Reduce the permissions on config and JAR files with these commands:
&lt;pre&gt;
  chmod 755 /usr/share/java/apache-maven-3.0.2/conf
  chmod 644 /usr/share/java/apache-maven-3.0.2/conf/settings.xml
  chmod 644 /usr/share/java/apache-maven-3.0.2/boot/*.jar
  chmod 644 /usr/share/java/apache-maven-3.0.2/lib/*.jar
&lt;/pre&gt;
At this point, the new Maven is installed. But the command &lt;span class="code"&gt;mvn&lt;/span&gt; is still linked to the old installation. The next step will fix this.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
3. Link /usr/share/maven to /usr/share/java/apache-maven-3.0.2
&lt;/span&gt;
&lt;br /&gt;
Change directories:
&lt;pre&gt;  cd /usr/share&lt;/pre&gt;
Remove the link to the old version of Maven:
&lt;pre&gt;  unlink maven&lt;/pre&gt;
Replace the old link with a new soft link to the new Maven 3.0.2 installation:
&lt;pre&gt;  ln -s java/apache-maven-3.0.2 maven&lt;/pre&gt;
Exit the root session:
&lt;pre&gt;  exit&lt;/pre&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Verify Installation
&lt;/span&gt;
&lt;br /&gt;
At this point, invoking Maven with the command &lt;span class="code"&gt;mvn -v&lt;/span&gt; from the Terminal should call the newly installed version:
&lt;pre&gt;
  bash-3.2$ mvn -v
  Apache Maven 3.0.2 (r1056850; 2011-01-08 16:58:10-0800)
  Java version: 1.6.0_22, vendor: Apple Inc.
  Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x", version: "10.6.6", arch: "i386", family: "mac"
&lt;/pre&gt;
After successful installation, the directory structure should be:
&lt;pre&gt;
  /usr/share/maven -&gt; java/apache-maven-3.0.2
  /usr/share/java/apache-maven-3.0.2
  /usr/share/java/apache-maven-3.0.2/bin
  /usr/share/java/apache-maven-3.0.2/bin/m2.conf
  /usr/share/java/apache-maven-3.0.2/bin/mvn
  /usr/share/java/apache-maven-3.0.2/bin/mvn.bat
  /usr/share/java/apache-maven-3.0.2/bin/mvnDebug
  /usr/share/java/apache-maven-3.0.2/bin/mvnDebug.bat
  /usr/share/java/apache-maven-3.0.2/bin/mvnyjp
  /usr/share/java/apache-maven-3.0.2/boot
  /usr/share/java/apache-maven-3.0.2/boot/plexus-classworlds-2.4.jar
  /usr/share/java/apache-maven-3.0.2/conf
  /usr/share/java/apache-maven-3.0.2/conf/settings.xml
  /usr/share/java/apache-maven-3.0.2/lib
  /usr/share/java/apache-maven-3.0.2/lib/aether-api-1.9.jar
  /usr/share/java/apache-maven-3.0.2/lib/aether-connector-wagon-1.9.jar
  /usr/share/java/apache-maven-3.0.2/lib/aether-impl-1.9.jar
  /usr/share/java/apache-maven-3.0.2/lib/aether-spi-1.9.jar
  /usr/share/java/apache-maven-3.0.2/lib/aether-util-1.9.jar
  /usr/share/java/apache-maven-3.0.2/lib/commons-cli-1.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-aether-provider-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-artifact-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-compat-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-core-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-embedder-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-model-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-model-builder-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-plugin-api-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-repository-metadata-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-settings-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/maven-settings-builder-3.0.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/nekohtml-1.9.6.2.jar
  /usr/share/java/apache-maven-3.0.2/lib/plexus-cipher-1.4.jar
  /usr/share/java/apache-maven-3.0.2/lib/plexus-component-annotations-1.5.5.jar
  /usr/share/java/apache-maven-3.0.2/lib/plexus-interpolation-1.14.jar
  /usr/share/java/apache-maven-3.0.2/lib/plexus-sec-dispatcher-1.3.jar
  /usr/share/java/apache-maven-3.0.2/lib/plexus-utils-2.0.4.jar
  /usr/share/java/apache-maven-3.0.2/lib/sisu-guice-2.9.1-noaop.jar
  /usr/share/java/apache-maven-3.0.2/lib/sisu-inject-bean-1.4.3.1.jar
  /usr/share/java/apache-maven-3.0.2/lib/sisu-inject-plexus-1.4.3.1.jar
  /usr/share/java/apache-maven-3.0.2/lib/wagon-file-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.2/lib/wagon-http-lightweight-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.2/lib/wagon-http-shared-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.2/lib/wagon-provider-api-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.2/lib/xercesMinimal-1.9.6.2.jar
  /usr/share/java/apache-maven-3.0.2/LICENSE.txt
  /usr/share/java/apache-maven-3.0.2/NOTICE.txt
  /usr/share/java/apache-maven-3.0.2/README.txt
&lt;/pre&gt;
The Windows &lt;span class="code"&gt;.bat&lt;/span&gt; files in the &lt;span class="code"&gt;bin&lt;/span&gt; directory are not needed, but they don't hurt anything. The original archive downloaded to the Desktop can be safely removed now that Maven was upgraded successfully.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Alternative Installation Methods
&lt;/span&gt;
&lt;br /&gt;
If you are already using &lt;a href="http://www.macports.org/" target="_new"&gt;MacPorts&lt;/a&gt;, you can upgrade Maven using this simple command:
&lt;pre&gt;  sudo port install maven3&lt;/pre&gt;
If you wish to install MacPorts, check the MacPorts &lt;a href="http://www.macports.org/install.php" target="_new"&gt;installation page&lt;/a&gt; for more information. There are &lt;span class="code"&gt;.dmg&lt;/span&gt; disk images available for Snow Leopard that make installation very easy.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-1719846194747156026?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/1719846194747156026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2011/01/updating-to-maven-302-in-mac-os-x-snow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/1719846194747156026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/1719846194747156026'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2011/01/updating-to-maven-302-in-mac-os-x-snow.html' title='Updating to Maven 3.0.2 in Mac OS X Snow Leopard'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-8981214494518451754</id><published>2010-10-25T00:41:00.000-07:00</published><updated>2010-12-07T18:25:33.571-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='Snow Leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='share'/><category scheme='http://www.blogger.com/atom/ns#' term='usr'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.5'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.4'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0.1'/><category scheme='http://www.blogger.com/atom/ns#' term='MVN'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6'/><category scheme='http://www.blogger.com/atom/ns#' term='Install'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Maven'/><category scheme='http://www.blogger.com/atom/ns#' term='manual'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='Upgrade'/><title type='text'>Updating to Maven 3 in Mac OS X Snow Leopard</title><content type='html'>Mac OS X 10.6.5 ships with Maven 2.2.0 installed. Invoking Maven from the Terminal with the &lt;span class="code"&gt;mvn -v&lt;/span&gt; command produces the following output:
&lt;br /&gt;
&lt;pre&gt;
  bash-3.2# mvn -v
  Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
  Java version: 1.6.0_22
  Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.6.5" arch: "i386" Family: "mac"
&lt;/pre&gt;
To manually upgrade to Maven 3, complete these 3 steps:
&lt;ol&gt;
&lt;li&gt;Download Maven 3 archive&lt;/li&gt;
&lt;li&gt;Unpack archive into /usr/share/java/&lt;/li&gt;
&lt;li&gt;Link /usr/share/maven to /usr/share/java/apache-maven-3.0.1&lt;/li&gt;
&lt;/ol&gt;
Below are the details of each step.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
1. Download Maven 3 archive
&lt;/span&gt;
&lt;br /&gt;
Go to the &lt;a href="http://maven.apache.org/download.html" target="_new"&gt;Maven download site&lt;/a&gt; and download the file named &amp;#147apache-maven-3.0.1-bin.tar.gz&amp;#148 to your Desktop.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
2. Unpack archive into /usr/share/java/
&lt;/span&gt;
&lt;br /&gt;
Open the Terminal. You will need root access to install Maven. Type the following to open a root shell:
&lt;pre&gt;  sudo bash&lt;/pre&gt;
Type your administrator password if prompted. Copy the file that you downloaded in step 1 to the directory where the new Maven will be installed by typing this command:
&lt;pre&gt;  cp ~/Desktop/apache-maven-3.0.1-bin.tar.gz /usr/share/java/&lt;/pre&gt;
Change to the installation directory by entering this command:
&lt;pre&gt;  cd /usr/share/java/&lt;/pre&gt;
Unpack the archive, which will create a new directory called &lt;span class="code"&gt;apache-maven-3.0.1&lt;/span&gt;:
&lt;pre&gt;  tar xzf apache-maven-3.0.1-bin.tar.gz&lt;/pre&gt;
Remove the archive file - it is no longer needed:
&lt;pre&gt;  rm apache-maven-3.0.1-bin.tar.gz&lt;/pre&gt;
Remove quarantine status from trusted Maven installation files:
&lt;pre&gt;  xattr -dr com.apple.quarantine apache-maven-3.0.1/&lt;/pre&gt;
Reduce the permissions on config and JAR files with these commands:
&lt;pre&gt;
  chmod 755 /usr/share/java/apache-maven-3.0.1/conf
  chmod 644 /usr/share/java/apache-maven-3.0.1/conf/settings.xml
  chmod 644 /usr/share/java/apache-maven-3.0.1/boot/*.jar
  chmod 644 /usr/share/java/apache-maven-3.0.1/lib/*.jar
&lt;/pre&gt;
At this point, the new Maven is installed. But the command &lt;span class="code"&gt;mvn&lt;/span&gt; is still linked to the old installation. The next step will fix this.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
3. Link /usr/share/maven to /usr/share/java/apache-maven-3.0.1
&lt;/span&gt;
&lt;br /&gt;
Change directories:
&lt;pre&gt;  cd /usr/share&lt;/pre&gt;
Remove the link to the old version of Maven:
&lt;pre&gt;  unlink maven&lt;/pre&gt;
Replace the old link with a new soft link to the new Maven 3.0 installation:
&lt;pre&gt;  ln -s java/apache-maven-3.0.1 maven&lt;/pre&gt;
Exit the root session:
&lt;pre&gt;  exit&lt;/pre&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Verify Installation
&lt;/span&gt;
&lt;br /&gt;
At this point, invoking Maven with the command &lt;span class="code"&gt;mvn -v&lt;/span&gt; from the Terminal should call the newly installed version:
&lt;pre&gt;
  bash-3.2$ mvn -v
  Apache Maven 3.0.1 (r1038046; 2010-11-23 02:58:32-0800)
  Java version: 1.6.0_22
  Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.6.5" arch: "i386" Family: "mac"
&lt;/pre&gt;
After successful installation, the directory structure should be:
&lt;pre&gt;
  /usr/share/maven -&gt; java/apache-maven-3.0.1
  /usr/share/java/apache-maven-3.0.1
  /usr/share/java/apache-maven-3.0.1/bin
  /usr/share/java/apache-maven-3.0.1/bin/m2.conf
  /usr/share/java/apache-maven-3.0.1/bin/mvn
  /usr/share/java/apache-maven-3.0.1/bin/mvn.bat
  /usr/share/java/apache-maven-3.0.1/bin/mvnDebug
  /usr/share/java/apache-maven-3.0.1/bin/mvnDebug.bat
  /usr/share/java/apache-maven-3.0.1/bin/mvnyjp
  /usr/share/java/apache-maven-3.0.1/boot
  /usr/share/java/apache-maven-3.0.1/boot/plexus-classworlds-2.4.jar
  /usr/share/java/apache-maven-3.0.1/conf
  /usr/share/java/apache-maven-3.0.1/conf/settings.xml
  /usr/share/java/apache-maven-3.0.1/lib
  /usr/share/java/apache-maven-3.0.1/lib/aether-api-1.8.jar
  /usr/share/java/apache-maven-3.0.1/lib/aether-connector-wagon-1.8.jar
  /usr/share/java/apache-maven-3.0.1/lib/aether-impl-1.8.jar
  /usr/share/java/apache-maven-3.0.1/lib/aether-spi-1.8.jar
  /usr/share/java/apache-maven-3.0.1/lib/aether-util-1.8.jar
  /usr/share/java/apache-maven-3.0.1/lib/commons-cli-1.2.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-aether-provider-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-artifact-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-compat-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-core-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-embedder-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-model-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-model-builder-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-plugin-api-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-repository-metadata-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-settings-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/maven-settings-builder-3.0.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/nekohtml-1.9.6.2.jar
  /usr/share/java/apache-maven-3.0.1/lib/plexus-cipher-1.4.jar
  /usr/share/java/apache-maven-3.0.1/lib/plexus-component-annotations-1.5.5.jar
  /usr/share/java/apache-maven-3.0.1/lib/plexus-interpolation-1.14.jar
  /usr/share/java/apache-maven-3.0.1/lib/plexus-sec-dispatcher-1.3.jar
  /usr/share/java/apache-maven-3.0.1/lib/plexus-utils-2.0.4.jar
  /usr/share/java/apache-maven-3.0.1/lib/sisu-guice-2.9.1-noaop.jar
  /usr/share/java/apache-maven-3.0.1/lib/sisu-inject-bean-1.4.3.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/sisu-inject-plexus-1.4.3.1.jar
  /usr/share/java/apache-maven-3.0.1/lib/wagon-file-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.1/lib/wagon-http-lightweight-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.1/lib/wagon-http-shared-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.1/lib/wagon-provider-api-1.0-beta-7.jar
  /usr/share/java/apache-maven-3.0.1/lib/xercesMinimal-1.9.6.2.jar
  /usr/share/java/apache-maven-3.0.1/LICENSE.txt
  /usr/share/java/apache-maven-3.0.1/NOTICE.txt
  /usr/share/java/apache-maven-3.0.1/README.txt
&lt;/pre&gt;
The Windows &lt;span class="code"&gt;.bat&lt;/span&gt; files in the &lt;span class="code"&gt;bin&lt;/span&gt; directory are not needed, but they don't hurt anything. The original archive downloaded to the Desktop can be safely removed now that Maven was upgraded successfully.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Alternative Installation Methods
&lt;/span&gt;
&lt;br /&gt;
If you are already using &lt;a href="http://www.macports.org/" target="_new"&gt;MacPorts&lt;/a&gt;, you can upgrade Maven using this simple command:
&lt;pre&gt;  sudo port install maven3&lt;/pre&gt;
If you wish to install MacPorts, check the MacPorts &lt;a href="http://www.macports.org/install.php" target="_new"&gt;installation page&lt;/a&gt; for more information. There are &lt;span class="code"&gt;.dmg&lt;/span&gt; disk images available for Snow Leopard that make installation very easy.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-8981214494518451754?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/8981214494518451754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2010/10/updating-to-maven-3-in-mac-os-x-snow.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8981214494518451754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8981214494518451754'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2010/10/updating-to-maven-3-in-mac-os-x-snow.html' title='Updating to Maven 3 in Mac OS X Snow Leopard'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-4230656838381397874</id><published>2010-08-09T00:33:00.000-07:00</published><updated>2010-10-25T01:00:12.556-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tar'/><category scheme='http://www.blogger.com/atom/ns#' term='Snow Leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='share'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.3'/><category scheme='http://www.blogger.com/atom/ns#' term='usr'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.5'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6.4'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='MVN'/><category scheme='http://www.blogger.com/atom/ns#' term='10.6'/><category scheme='http://www.blogger.com/atom/ns#' term='Install'/><category scheme='http://www.blogger.com/atom/ns#' term='2.2.1'/><category scheme='http://www.blogger.com/atom/ns#' term='3.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Maven'/><category scheme='http://www.blogger.com/atom/ns#' term='manual'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='Upgrade'/><title type='text'>Updating to Maven 2.2.1 in Mac OS X Snow Leopard</title><content type='html'>Mac OS X 10.6.4 ships with Maven 2.2.0 installed. Invoking Maven from the Terminal with the &lt;span class="code"&gt;mvn -v&lt;/span&gt; command produces the following output:
&lt;br /&gt;
&lt;pre&gt;
  bash-3.2# mvn -v
  Apache Maven 2.2.0 (r788681; 2009-06-26 06:04:01-0700)
  Java version: 1.6.0_20
  Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.6.4" arch: "i386" Family: "mac
&lt;/pre&gt;
To manually upgrade to Maven 2.2.1, complete these 3 steps:
&lt;ol&gt;
&lt;li&gt;Download Maven 2.2.1 archive&lt;/li&gt;
&lt;li&gt;Unpack archive into /usr/share/java/&lt;/li&gt;
&lt;li&gt;Link /usr/share/maven to /usr/share/java/apache-maven-2.2.1&lt;/li&gt;
&lt;/ol&gt;
Below are the details of each step.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
1. Download Maven 2.2.1 archive
&lt;/span&gt;
&lt;br /&gt;
Go to the &lt;a href="http://maven.apache.org/download.html" target="_new"&gt;Maven download site&lt;/a&gt; and download the file named &amp;#147apache-maven-2.2.1-bin.tar.gz&amp;#148 to your Desktop.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
2. Unpack archive into /usr/share/java/
&lt;/span&gt;
&lt;br /&gt;
Open the Terminal. You will need root access to install Maven. Type the following to open a root shell:
&lt;pre&gt;  sudo bash&lt;/pre&gt;
Type your administrator password if prompted. Copy the file that you downloaded in step 1 to the directory where the new Maven will be installed by typing this command:
&lt;pre&gt;  cp ~/Desktop/apache-maven-2.2.1-bin.tar.gz /usr/share/java/&lt;/pre&gt;
Change to the installation directory by entering this command:
&lt;pre&gt;  cd /usr/share/java/&lt;/pre&gt;
Unpack the archive, which will create a new directory called &lt;span class="code"&gt;apache-maven-2.2.1&lt;/span&gt;:
&lt;pre&gt;  tar xzf apache-maven-2.2.1-bin.tar.gz&lt;/pre&gt;
Remove the archive file - it is no longer needed:
&lt;pre&gt;  rm apache-maven-2.2.1-bin.tar.gz&lt;/pre&gt;
Remove quarantine status from trusted Maven installation files:
&lt;pre&gt;  xattr -dr com.apple.quarantine apache-maven-2.2.1/&lt;/pre&gt;
If the &lt;span class="code"&gt;mvn&lt;/span&gt; or &lt;span class="code"&gt;mvnDebug&lt;/span&gt; binaries are not already executable (they should be), you can make sure they are with these commands:
&lt;pre&gt;
  chmod 755 /usr/share/java/apache-maven-2.2.1/bin/mvn
  chmod 755 /usr/share/java/apache-maven-2.2.1/bin/mvnDebug
&lt;/pre&gt;
At this point, the new Maven is installed. But the command &lt;span class="code"&gt;mvn&lt;/span&gt; is still linked to the old installation. The next step will fix this.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
3. Link /usr/share/maven to /usr/share/java/apache-maven-2.2.1
&lt;/span&gt;
&lt;br /&gt;
Change directories:
&lt;pre&gt;  cd /usr/share&lt;/pre&gt;
Remove the link to the old version of Maven:
&lt;pre&gt;  unlink maven&lt;/pre&gt;
Replace the old link with a new soft link to the new Maven 2.2.1 installation:
&lt;pre&gt;  ln -s java/apache-maven-2.2.1 maven&lt;/pre&gt;
Exit the root session:
&lt;pre&gt;  exit&lt;/pre&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Verify Installation
&lt;/span&gt;
&lt;br /&gt;
At this point, invoking Maven with the command &lt;span class="code"&gt;mvn -v&lt;/span&gt; from the Terminal should call the newly installed version:
&lt;pre&gt;
  bash-3.2# mvn -v
  Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700)
  Java version: 1.6.0_20
  Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
  Default locale: en_US, platform encoding: MacRoman
  OS name: "mac os x" version: "10.6.4" arch: "i386" Family: "mac"
&lt;/pre&gt;
After successful installation, the directory structure should be:
&lt;pre&gt;
  /usr/share/maven@ -&gt; java/apache-maven-2.2.1
  /usr/share/java/apache-maven-2.2.1/
  /usr/share/java/apache-maven-2.2.1/bin/
  /usr/share/java/apache-maven-2.2.1/bin/m2.conf
  /usr/share/java/apache-maven-2.2.1/bin/mvn
  /usr/share/java/apache-maven-2.2.1/bin/mvn.bat
  /usr/share/java/apache-maven-2.2.1/bin/mvnDebug
  /usr/share/java/apache-maven-2.2.1/bin/mvnDebug.bat
  /usr/share/java/apache-maven-2.2.1/boot/
  /usr/share/java/apache-maven-2.2.1/boot/classworlds-1.1.jar
  /usr/share/java/apache-maven-2.2.1/conf/
  /usr/share/java/apache-maven-2.2.1/conf/settings.xml
  /usr/share/java/apache-maven-2.2.1/lib/
  /usr/share/java/apache-maven-2.2.1/lib/maven-2.2.1-uber.jar
  /usr/share/java/apache-maven-2.2.1/LICENSE.txt
  /usr/share/java/apache-maven-2.2.1/NOTICE.txt
  /usr/share/java/apache-maven-2.2.1/README.txt
&lt;/pre&gt;
The &lt;span class="code"&gt;.bat&lt;/span&gt; files in the &lt;span class="code"&gt;bin&lt;/span&gt; directory are not really needed, but they don't hurt anything. The original archive downloaded to the Desktop can be safely removed now that Maven was upgraded successfully.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Alternative Installation Methods
&lt;/span&gt;
&lt;br /&gt;
If you are already using &lt;a href="http://www.macports.org/" target="_new"&gt;MacPorts&lt;/a&gt;, you can upgrade Maven using this simple command:
&lt;pre&gt;  sudo port install maven2&lt;/pre&gt;
If you wish to install MacPorts, check the MacPorts &lt;a href="http://www.macports.org/install.php" target="_new"&gt;installation page&lt;/a&gt; for more information about installing MacPorts. There are &lt;span class="code"&gt;.dmg&lt;/span&gt; disk images available for Snow Leopard that make installation very easy.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-4230656838381397874?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/4230656838381397874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2010/08/updating-maven-in-mac-os-x-snow-leopard.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/4230656838381397874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/4230656838381397874'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2010/08/updating-maven-in-mac-os-x-snow-leopard.html' title='Updating to Maven 2.2.1 in Mac OS X Snow Leopard'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-8647266896856202707</id><published>2009-06-18T12:26:00.000-07:00</published><updated>2009-07-02T19:57:30.414-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='web start'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaFX'/><category scheme='http://www.blogger.com/atom/ns#' term='Library'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><category scheme='http://www.blogger.com/atom/ns#' term='update'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='Applications'/><category scheme='http://www.blogger.com/atom/ns#' term='Update 4'/><category scheme='http://www.blogger.com/atom/ns#' term='OS X'/><category scheme='http://www.blogger.com/atom/ns#' term='Utilities'/><category scheme='http://www.blogger.com/atom/ns#' term='CoreServices'/><category scheme='http://www.blogger.com/atom/ns#' term='JNLP'/><category scheme='http://www.blogger.com/atom/ns#' term='10.5'/><category scheme='http://www.blogger.com/atom/ns#' term='Leopard'/><category scheme='http://www.blogger.com/atom/ns#' term='System'/><title type='text'>How to Fix Java Web Start After Installing Java for Mac OS X 10.5 Update 4</title><content type='html'>Java for Mac OS X 10.5 Update 4 was more than a security fix. It also moved the Java Web Start application from the /Applications/Utilities/Java/ directory to /System/Library/CoreServices/. This broke all Java Web Start applications that were launched from anywhere other than the command line. (The command line application for Java Web Start can be found at /usr/bin/javaws.)
&lt;br /&gt;
&lt;br /&gt;
In order to restore the desired behavior for Java and JavaFX web applications that are launched either from a web browser or from a previously downloaded Web Start file, the Finder needs to be told what to do with JNLP files. One way to do this is to Get Info on any JNLP file in the Finder, as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SjqY3zIWVEI/AAAAAAAAACU/OS0UFEU0v7I/s1600-h/GetInfo.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 265px; height: 303px;" src="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SjqY3zIWVEI/AAAAAAAAACU/OS0UFEU0v7I/s400/GetInfo.png" alt="" id="BLOGGER_PHOTO_ID_5348755591841338434" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
The image above shows that TextEdit is the application that will open the JNLP file. Instead of TextEdit.app, the combo box should show Java Web Start.app as the default application to open all JNLP files, as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SjqbadsPigI/AAAAAAAAACc/yYRbRKupC0w/s1600-h/GetInfoWebStart.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 265px; height: 303px;" src="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SjqbadsPigI/AAAAAAAAACc/yYRbRKupC0w/s400/GetInfoWebStart.png" alt="" id="BLOGGER_PHOTO_ID_5348758386404985346" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on the combo box and select &amp;#147Other...&amp;#148, then navigate to the &amp;#147System&amp;#148 folder, then the &amp;#147Library&amp;#148 folder, then the &amp;#147CoreServices&amp;#148 folder, and select the &amp;#147Java Web Start.app&amp;#148 file as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Lw-ycwOYOvU/SjqiRNn7fsI/AAAAAAAAACk/3IwOUIB3WuI/s1600-h/GetInfoChooseApp.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 335px;" src="http://4.bp.blogspot.com/_Lw-ycwOYOvU/SjqiRNn7fsI/AAAAAAAAACk/3IwOUIB3WuI/s400/GetInfoChooseApp.png" alt="" id="BLOGGER_PHOTO_ID_5348765924054499010" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Select the &amp;#147Always Open With&amp;#148 checkbox. Click the &amp;#147Add&amp;#148 button and close the &amp;#147Get Info&amp;#148 window.
&lt;br /&gt;
&lt;br /&gt;
That's it! Now all Web Start applications will launch correctly either from a web browser or from the Finder.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-8647266896856202707?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/8647266896856202707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/06/mac-java-update-breaks-java-web-start.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8647266896856202707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8647266896856202707'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/06/mac-java-update-breaks-java-web-start.html' title='How to Fix Java Web Start After Installing Java for Mac OS X 10.5 Update 4'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Lw-ycwOYOvU/SjqY3zIWVEI/AAAAAAAAACU/OS0UFEU0v7I/s72-c/GetInfo.png' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-2568317525783493782</id><published>2009-05-25T04:51:00.000-07:00</published><updated>2009-05-30T11:38:19.008-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Application'/><category scheme='http://www.blogger.com/atom/ns#' term='innerHTML'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='web start'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='Lazy'/><category scheme='http://www.blogger.com/atom/ns#' term='div'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaFX'/><category scheme='http://www.blogger.com/atom/ns#' term='slow'/><category scheme='http://www.blogger.com/atom/ns#' term='time'/><category scheme='http://www.blogger.com/atom/ns#' term='page'/><category scheme='http://www.blogger.com/atom/ns#' term='Load'/><category scheme='http://www.blogger.com/atom/ns#' term='button'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='delayed'/><category scheme='http://www.blogger.com/atom/ns#' term='javafxString'/><category scheme='http://www.blogger.com/atom/ns#' term='getElementById'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><category scheme='http://www.blogger.com/atom/ns#' term='dtfx.js'/><title type='text'>Lazy Loading of JavaFX Applets</title><content type='html'>Web pages that contain large applets or many small applets can load slowly. This annoyance is one of the reasons that applets have historically been &lt;a href="http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&amp;ixPost=34550" target="_new"&gt;unpopular&lt;/a&gt;. Sun has been pushing to &lt;a href="http://www.javaworld.com/javaworld/jw-05-2008/jw-05-applets.html" target="_new"&gt;revive&lt;/a&gt; the applet by improving its reliability and encouraging its use for JavaFX deployment. Despite these improvements, JavaFX applets can produce unacceptable page load times. Java Web Start is an alternative deployment mechanism and is currently regarded as a more robust solution. Web Start avoids browser compatibility issues by running apps in a separate window from the browser, thus not affecting page load time. But there are times when it is preferable to run an application from directly within a web page.
&lt;br /&gt;
&lt;br /&gt;
I will show how to keep an applet within the browser window and delay applet loading until the user performs some input action, like pressing a button. The applet is said to be loaded lazily, rather than loaded eagerly at page load time. Solutions for both JavaFX and traditional Java applets will be presented.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
JavaFX Applets
&lt;/span&gt;
&lt;br /&gt;
One way to insert a JavaFX applet into a web page is to include two JavaScripts. The first links to Sun's dtfx.js JavaScript file:
&lt;pre class="brush: html; light: true;" &gt;
&amp;lt;script src="http://dl.javafx.com/1.1/dtfx.js" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;

The second script passes the applet's launch parameters to the &amp;#147&lt;span class="code"&gt;javafx&lt;/span&gt;&amp;#148 function defined in the dftx.js file. Here is an example:
&lt;pre class="brush: js; gutter: false;"&gt;
&amp;lt;script type="text/javascript"&amp;gt;
  javafx({
    archive: "http://jfreechartscaler.appspot.com/fx/jfreechart-scalable-scrollable.jar",
    draggable: true,
    width: 466,
    height: 288,
    code: "jfreechartscalablescrollable.Main",
    name: "jfreechart-scalable-scrollable"
  });
&amp;lt;/script&amp;gt;
&lt;/pre&gt;

The &amp;#147&lt;span class="code"&gt;javafx&lt;/span&gt;&amp;#148 function above reads in the applet launch parameters and embeds the &lt;span class="code"&gt;&amp;lt;APPLET&amp;gt;&lt;/span&gt; tag into the HTML of the web page. The applet tag is customized for best appearance on various operating systems and web browsers.
&lt;br /&gt;&lt;br /&gt;
Rather than calling the &amp;#147&lt;span class="code"&gt;javafx&lt;/span&gt;&amp;#148 function to insert the applet tag into the web page, we will instead call the &amp;#147&lt;span class="code"&gt;javafxString&lt;/span&gt;&amp;#148 function and save the generated HTML into a string. The entire operation will be placed in a JavaScript function called &lt;span class="code"&gt;startApplet()&lt;/span&gt;. So the JavaScript above will be replaced with the following script:

&lt;pre class="brush: js; gutter: false;"&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
  &amp;lt;!--
  function startApplet() {
    fxstring = javafxString({
      archive: "http://jfreechartscaler.appspot.com/fx/jfreechart-scalable-scrollable.jar",
      draggable: true,
      width: 466,
      height: 288,
      code: "jfreechartscalablescrollable.Main",
      name: "jfreechart-scalable-scrollable"
    });
    document.getElementById('appletdiv').innerHTML=fxstring;
  }
  //--&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
The function refers to a &lt;span class="code"&gt;&amp;lt;div&amp;gt;&lt;/span&gt; named &amp;#145&lt;span class="code"&gt;appletdiv&lt;/span&gt;&amp;#146 that will contain the applet. When the function is executed, the inner HTML of the &lt;span class="code"&gt;&amp;lt;div&amp;gt;&lt;/span&gt; will be replaced with the &lt;span class="code"&gt;&amp;lt;APPLET&amp;gt;&lt;/span&gt; tag returned from the &lt;span class="code"&gt;javafxString&lt;/span&gt; function. The function is called when the user clicks on an image that is initially placed in the &lt;span class="code"&gt;&amp;lt;div&amp;gt;&lt;/span&gt; when the page loads:

&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;div id=&amp;quot;appletdiv&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;http://patrickwebster.synthasite.com/resources/scroller-applet.png&amp;quot; alt=&amp;quot;Click here to start applet.&amp;quot; onmousedown=&amp;quot;startApplet()&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;

I chose to fill the &lt;span class="code"&gt;div&lt;/span&gt; with an image that is the same size as the applet. This prevents the layout of the page from changing when the applet loads, providing a seamless transition. If you are not concerned with minimizing the intrusiveness of loading the applet, you may initiate applet loading with a button press using this more simple &lt;span class="code"&gt;div&lt;/span&gt;:

&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;div id=&amp;quot;appletdiv&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Click here to start applet&amp;quot; onclick=&amp;quot;startApplet()&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
If all this applet stuff is new to you, I recommend that you first try lazy loading of applets using the simple button press. After everything is working correctly, you may replace the button with a custom image if desired.
&lt;br /&gt;&lt;br /&gt;
A live example of using a clickable image to load a JavaFX applet can be found &lt;a href="http://patrickwebster.blogspot.com/2009/03/scalable-jfreechart-javafx-applet.html"&gt;here&lt;/a&gt;. The applet on that page can be embedded into almost any web page by pasting this snippet into the HTML code:
&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;script src=&amp;quot;http://dl.javafx.com/1.1/dtfx.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
  &amp;lt;!--
  function startApplet() {
    fxstring = javafxString(
      {
      archive: &amp;quot;http://jfreechartscaler.appspot.com/fx/jfreechart-scalable-scrollable.jar&amp;quot;,
      draggable: true,
      width: 466,
      height: 288,
      code: &amp;quot;jfreechartscalablescrollable.Main&amp;quot;,
      name: &amp;quot;jfreechart-scalable-scrollable&amp;quot;
      }
    );
    document.getElementById('appletdiv').innerHTML=fxstring;
  }
  //--&amp;gt;
&amp;lt;/script&amp;gt;

&amp;lt;div id=&amp;quot;appletdiv&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;http://patrickwebster.synthasite.com/resources/scroller-applet.png&amp;quot; alt=&amp;quot;Click here to start applet.&amp;quot; onmousedown=&amp;quot;startApplet()&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Java Applets
&lt;/span&gt;
&lt;br /&gt;
Lazy loading of standard Java applets is easier than with JavaFX applets because the applet code is known without having to query a server-side JavaScript function. The concept of using a &lt;span class="code"&gt;div&lt;/span&gt; as a placeholder is the same as in the JavaFX applet case. An example of a traditional eager-loading applet is here:

&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;applet codebase=&amp;quot;http://apppspot.appspot.com/java/lib&amp;quot; archive=&amp;quot;jfreechart-magnifier-applet.jar,jfreechart-1.0.12.jar,jcommon-1.0.15.jar,jxlayer.jar&amp;quot; code=&amp;quot;JFreeChartMagnifierApplet&amp;quot; alt=&amp;quot;Dude, like you totally need Java SE 6 or later to run this applet.&amp;quot; height=&amp;quot;288&amp;quot; width=&amp;quot;466&amp;quot;&amp;gt;
 &amp;lt;param name=&amp;quot;draggable&amp;quot; value=&amp;quot;true&amp;quot;&amp;gt;
 &amp;lt;param name=&amp;quot;java_arguments&amp;quot; value=&amp;quot;-Djnlp.packEnabled=true&amp;quot;&amp;gt;
&amp;lt;/applet&amp;gt;
&lt;/pre&gt;
To transform this eager applet into a lazy one, we will again write a JavaScript function to build the &lt;span class="code"&gt;&amp;lt;applet&amp;gt;&lt;/span&gt; tag into string form. But we will concatenate it manually because it is already known. Building the &lt;span class="code"&gt;&amp;lt;applet&amp;gt;&lt;/span&gt; tag above into a string is achieved with this JavaScript:
&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;
  &amp;lt;!--
  function startApplet() {
    appletsource='&amp;lt;applet code=&amp;quot;JFreeChartMagnifierApplet&amp;quot; codebase=&amp;quot;http://apppspot.appspot.com/java/lib&amp;quot; archive=&amp;quot;jfreechart-magnifier-applet.jar,jfreechart-1.0.12.jar,jcommon-1.0.15.jar,jxlayer.jar&amp;quot; alt=&amp;quot;Dude, like you totally need Java SE 6 or later to run this applet.&amp;quot; height=&amp;quot;288&amp;quot; width=&amp;quot;466&amp;quot;&amp;gt;\n'; 
    appletsource+='&amp;lt;param name=&amp;quot;draggable&amp;quot; value=&amp;quot;true&amp;quot;&amp;gt;\n';
    appletsource+='&amp;lt;param name=&amp;quot;java_arguments&amp;quot; value=&amp;quot;-Djnlp.packEnabled=true&amp;quot;&amp;gt;\n'; 
    appletsource+='&amp;lt;/applet&amp;gt;\n'; 
    document.getElementById('appletdiv').innerHTML=appletsource;
  }
  //--&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
The string &lt;span class="code"&gt;appletsource&lt;/span&gt; is set equal to the inner HTML of the &lt;span class="code"&gt;div&lt;/span&gt; named &amp;#145&lt;span class="code"&gt;appletdiv&lt;/span&gt;&amp;#146. The &lt;span class="code"&gt;div&lt;/span&gt; is nearly identical to the JavaFX case presented earlier:
&lt;pre class="brush: html; gutter: false;"&gt;
&amp;lt;div id=&amp;quot;appletdiv&amp;quot; style=&amp;quot;text-align: center;&amp;quot;&amp;gt;
  &amp;lt;input type=&amp;quot;image&amp;quot; src=&amp;quot;http://patrickwebster.synthasite.com/resources/magnifier-applet.png&amp;quot; alt=&amp;quot;Click here to start applet.&amp;quot; onmousedown=&amp;quot;startApplet()&amp;quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;
To view the live example of this lazy loading java applet, click &lt;a href="http://patrickwebster.blogspot.com/2009/01/jfreechart-and-jxlayer-adjustable.html"&gt;here&lt;/a&gt;.

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;
Conclusion
&lt;/span&gt;
&lt;br /&gt;
To provide the best user experience, page load times should be minimized. Lazy loading of applets ensures that applet load time does not contribute to initial page load time. The user only incurs the penalty of waiting for a potentially slow-loading applet after choosing to do so. The user has the right to not load the applet, and in doing so is charged a minimal cost. The only cost is the initial page load time, which can be quite small compared to the time to load a large applet. By amortizing the page load and applet load times, the perceived wait time is decreased, resulting in an overall improved experience. It is polite to put the user in control. It is rude to force the user to wait a long time for a page to load without giving any warning. So please, be lazy!
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-2568317525783493782?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/2568317525783493782/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/05/lazy-loading-of-javafx-applets.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/2568317525783493782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/2568317525783493782'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/05/lazy-loading-of-javafx-applets.html' title='Lazy Loading of JavaFX Applets'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-7593440387995714085</id><published>2009-04-24T17:39:00.000-07:00</published><updated>2009-05-26T09:47:12.467-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='highlight'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaFX'/><category scheme='http://www.blogger.com/atom/ns#' term='regular expression'/><category scheme='http://www.blogger.com/atom/ns#' term='highlighter'/><category scheme='http://www.blogger.com/atom/ns#' term='source'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='keyword'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='Brush'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><category scheme='http://www.blogger.com/atom/ns#' term='SyntaxHighlighter'/><title type='text'>JavaFX Brush for SyntaxHighlighter</title><content type='html'>I wanted to display well-formatted JavaFX Script source code using Alex Gorbatchev's SyntaxHighlighter. But the current version of SyntaxHighlighter does not include a JavaFX brush. So I wrote one. A sample of highlighted code is below. Note that some of the code is a bit silly. It is written that way to exemplify the highlighting features.
&lt;br /&gt;
&lt;pre class="brush: javafx"&gt;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.scene.transform.Scale;
import javafx.stage.Stage;

/**
 * @author Patrick Webster
 */
var mouseX: Number;
var mouseY: Number;
var scale: Float = (-2.3 - 1.0) * -1.;
var egg: Circle;

Stage {
   title: "Easing Raw Egg"
   scene: Scene {
      fill: Color.BLACK
      height: 0x2EB  width: 0X30C
      content:
         egg = Circle {
            fill: Color.WHITE
            centerX: bind mouseX
            centerY: bind mouseY
            radius: 323.456e-02
            transforms: Scale {
               // Egg eases to moving mouse cursor
               pivotX: bind mouseX
               pivotY: bind mouseY
               x: bind scale * .02298E3
               y: bind scale *  32.56789
            }

            onMouseMoved: function( me: MouseEvent ) {
               updateMousePosition(me);
            }
            onMouseWheelMoved: function( we: MouseEvent ) {
               updateMousePosition(we);
               updateScale(we);
            }
         }
   }
}

function updateMousePosition(me : MouseEvent) : Void {
   mouseX = me.x;
   mouseY = me.y;
}

function updateScale(we: MouseEvent) : Float {
   var newScale = scale + (we.wheelRotation * -0.1);
   if (newScale &amp;lt; 1.0)
      return scale = 1.0000000e+00;
   return scale = newScale;
}
&lt;/pre&gt;
&lt;br /&gt;
There are others who have written JavaFX brushes for SyntaxHighlighter, but they all lack the functionality that I desire. My implementation differs from others by including these additional features:
&lt;ol&gt;
&lt;li&gt;Negative signs for constants are highlighted.&lt;/li&gt;
&lt;li&gt;Constants with scientific notation are highlighted.&lt;/li&gt;
&lt;li&gt;Leading and trailing decimal points are highlighted.&lt;/li&gt;
&lt;li&gt;Keywords are up-to-date for JavaFX 1.1.1.&lt;/li&gt;
&lt;li&gt;Deprecated keywords are supported.&lt;/li&gt;
&lt;li&gt;JavaFX built-in data types are highlighted differently than keywords.&lt;/li&gt;
&lt;/ol&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Constants&lt;/span&gt;
&lt;br /&gt;
In order to recognize all number formats for constants in JavaFX Script, I wrote the following horrendous regular expression:
&lt;blockquote&gt;
/(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi
&lt;/blockquote&gt;
I am not going to explain every little detail of the above mess, but I will say that there are basically three parts. The first part matches on regular numbers with an optional leading negative sign and decimal point. The middle part looks for scientific notation. The last part checks for hexadecimal format. The major assumption is that correct JavaFX Script is the input. It is possible for the above expression to match on illegal code, but the hope is that people will not be highlighting incorrect code on their blogs. One small problem is that the above regular expression will match on the binary subtraction operator if there is no space between the operator and the subtrahend:
&lt;pre class="brush: javafx; toolbar: false; gutter: false;" &gt;
def b: Double = a-4;
&lt;/pre&gt;
I would prefer if the minus operator were not highlighted. But in general, it is good style to surround binary operators with a space, so this is really not a big problem.

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Keywords&lt;/span&gt;
&lt;br /&gt;
As the JavaFX Script language evolves, keywords come and go. The latest JavaFX Script 1.1.1 keywords are listed &lt;a href="http://openjfx.java.sun.com/current-build/doc/reference/apas01.html" target="_new"&gt;here&lt;/a&gt;. I'm sure this list will need to be updated again after the next language revision. I also include a separate list of deprecated keywords that is easily commented-out if desired.

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Built-In Types&lt;/span&gt;
&lt;br /&gt;
There are several &lt;a href="http://java.sun.com/javafx/1/tutorials/core/dataTypes/" target="_new"&gt;built-in data types&lt;/a&gt; in JavaFX Script. I chose to highlight the following types in their own distinct color:
&lt;pre class="brush: javafx; toolbar: false; gutter: false;" &gt;
Boolean Byte Character Double Duration Float Integer Long Number Short String Void
&lt;/pre&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Blogger Usage&lt;/span&gt;
&lt;br /&gt;
If you followed my &lt;a href="http://patrickwebster.blogspot.com/2009/02/syntaxhighlighter-in-blogger.html"&gt;instructions&lt;/a&gt; on how to install SyntaxHighlighter into Blogger, then getting the JavaFX highlighter working will be a simple task. First you will need to download my brush file &lt;a href="http://patrickwebster.synthasite.com/resources/shBrushJavaFX.js.gz"&gt;here&lt;/a&gt;. Expand it and place it somewhere on the internet. Then insert a link to the brush file in your Blogger HTML template. For example, I inserted this line in my template:
&lt;blockquote&gt;
&amp;lt;script src='http://patrickwebster.googlepages.com/shBrushJavaFX.js' type='text/javascript'/&amp;gt;
&lt;/blockquote&gt;
I do not recommend that you link to my file because the file may move or change names at any time. Once the template is edited, new JavaFX code can be highlighted by wrapping it in the &lt;span class="code"&gt;&amp;lt;pre class="brush: javafx"&amp;gt;&lt;/span&gt; and &lt;span class="code"&gt;&amp;lt;/pre&amp;gt;&lt;/span&gt; tags. The brush aliases 'jfx' or 'javafx' may be used within the &lt;span class="code"&gt;&amp;lt;pre&amp;gt;&lt;/span&gt; tag.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Update: May 3rd, 2009&lt;/span&gt;
&lt;br /&gt;
The newly released version &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Changes:2.0.320" target="_new"&gt;2.0.320&lt;/a&gt; of SyntaxHighlighter includes a JavaFX brush! So you do not need to download my script. Simply upgrade to the new release and wrap your JavaFX code in the &lt;span class="code"&gt;&amp;lt;pre&amp;gt;&lt;/span&gt; tag as explained above. You can link to the hosted version of the brush file by adding the following line to the appropriate section of your Blogger template:
&lt;blockquote&gt;
&amp;lt;script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJavaFX.js' type='text/javascript'/&amp;gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-7593440387995714085?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/7593440387995714085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7593440387995714085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7593440387995714085'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlighter.html' title='JavaFX Brush for SyntaxHighlighter'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-8011427563511522749</id><published>2009-03-04T06:20:00.000-08:00</published><updated>2010-07-05T17:48:24.905-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Demo'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='pivotY'/><category scheme='http://www.blogger.com/atom/ns#' term='JavaFX'/><category scheme='http://www.blogger.com/atom/ns#' term='zoom'/><category scheme='http://www.blogger.com/atom/ns#' term='JFreeChart'/><category scheme='http://www.blogger.com/atom/ns#' term='pivotX'/><category scheme='http://www.blogger.com/atom/ns#' term='scale'/><category scheme='http://www.blogger.com/atom/ns#' term='transforms'/><category scheme='http://www.blogger.com/atom/ns#' term='scrollable'/><category scheme='http://www.blogger.com/atom/ns#' term='scroll'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='function'/><category scheme='http://www.blogger.com/atom/ns#' term='wheel'/><category scheme='http://www.blogger.com/atom/ns#' term='Swing'/><category scheme='http://www.blogger.com/atom/ns#' term='bind'/><category scheme='http://www.blogger.com/atom/ns#' term='JNLP'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Zoomable'/><category scheme='http://www.blogger.com/atom/ns#' term='Scalable'/><title type='text'>Scalable JFreeChart JavaFX Applet</title><content type='html'>A &lt;a href="http://patrickwebster.blogspot.com/2009/01/scalable-jfreechart-applet.html"&gt;previous post&lt;/a&gt; demonstrated an applet written in Swing that showed how to scale a &lt;a href="http://www.jfree.org/jfreechart/" target="_new"&gt;JFreeChart&lt;/a&gt; using the mouse wheel. That applet lacked the ability to scroll and explore the chart when zoomed-in. This post presents a similar applet, but with the added scrolling ability. Rather than using Swing exclusively, the applet below harnesses the power of JavaFX. The mouse wheel adjusts the zoom level. When zoomed in, the chart moves continuously with the pointer, allowing the user to scroll to any part of the chart simply by moving the mouse. Holding down the Control and Shift keys while moving the scroll wheel down returns the chart to unity scale. Mac users may have to click the &amp;#147Trust&amp;#148 or &amp;#147Allow&amp;#148 button in order to use the applet. Less-paranoid operating systems like Linux and Windows do not require any security confirmations. Scaling may not work in Safari on a Mac.
&lt;br /&gt;
&lt;br /&gt;

&lt;script src="http://dl.javafx.com/1.1/dtfx.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
  &lt;!--
  function startApplet() {
    fxstring = javafxString(
      {
        archive: "http://jfreechartscaler.appspot.com/fx/jfreechart-scalable-scrollable.jar",
        draggable: true,
        width: 466,
        height: 288,
        code: "jfreechartscalablescrollable.Main",
        name: "jfreechart-scalable-scrollable"
      }
    );
    document.getElementById('appletdiv').innerHTML=fxstring;
  }
  //--&gt;
&lt;/script&gt;

&lt;div id="appletdiv" style="text-align: center;"&gt;
  &lt;input type="image" src="http://patrickwebster.synthasite.com/resources/scroller-applet.png" alt="Click here to start applet." onmousedown="startApplet()" /&gt;
&lt;/div&gt;

&lt;span style=";font-size:78%;"&gt;
Note: Windows users may need to right-click on the chart to enable the mouse wheel adjustments. For some reason, the popup menu that appears after a right-click causes the applet to start listening to mouse wheel events. This is most noticeable when dragging the applet out of the browser and then closing the dragged-out applet and returning to the browser window. This problem does not occur on Mac or Linux.&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;The Code&lt;/span&gt;

&lt;br /&gt;
Unlike my previous Swing applets, the code for this applet consumes only one file. JavaFX gets a lot done in only a few lines of code. I'll run through the highlights of the code. The complete source &lt;a href="http://patrickwebster.synthasite.com/resources/JFreeChartScalableScrollable.zip"&gt;file&lt;/a&gt; is available to download.
&lt;br /&gt;
&lt;br /&gt;
First, constants and variables are declared:
&lt;pre class="brush: javafx"&gt;
def SCALING_INCREMENT: Number = 0.1;
def MINIMUM_SCALE: Number = 1.0;

var mouseX: Number;
var mouseY: Number;
var scale: Number = 1.0;

var chartPanel = new ChartPanel(createChart());
chartPanel.setPreferredSize(new Dimension(466, 288));
var chartComponent = SwingComponent.wrap(chartPanel);
&lt;/pre&gt;The &lt;span class="code"&gt;ChartPanel&lt;/span&gt; is declared just as in Swing, but with type &lt;span class="code"&gt;var&lt;/span&gt;. The key to getting the Swing &lt;span class="code"&gt;ChartPanel&lt;/span&gt; component into JavaFX is wrapping it in the &lt;span class="code"&gt;SwingComponent.wrap()&lt;/span&gt; method. This wrapped component will be the only content in a &lt;span class="code"&gt;Group&lt;/span&gt;, which is the only content of the &lt;span class="code"&gt;Scene&lt;/span&gt; as shown here:
&lt;pre class="brush: javafx"&gt;
Stage {
  title: &amp;quot;JFreeChart in JavaFX&amp;quot;
  scene: Scene {
    content: [
      Group {
        content: {
          chartComponent
        }
        transforms: Scale {
          // Bind pivot point to mouse position so
          // zooming is always centered at the pointer
          pivotX: bind mouseX
          pivotY: bind mouseY
          x: bind scale
          y: bind scale
        }
        onMouseMoved: function( me: MouseEvent ) {
          updateMousePosition(me);
        }
        onMouseWheelMoved: function( we: MouseEvent ) {
          updateMousePosition(we);
          updateScale(we);
        }
        onMouseEntered: function( me: MouseEvent ) {
          windowsHack();
        }
      }
    ]
  }
}
&lt;/pre&gt;The power of JavaFX is revealed in the bindings within the &lt;span class="code"&gt;transforms&lt;/span&gt; variable of the &lt;span class="code"&gt;Group&lt;/span&gt;. These four bindings update the scale of the chart whenever the variable &lt;span class="code"&gt;scale&lt;/span&gt; changes. Scaling is centered about a pivot point which is the current pointer position. So zooming is always centered at the mouse pointer.
&lt;br /&gt;
&lt;br /&gt;
There are two mouse handlers that update the bindings. The &lt;span class="code"&gt;onMouseMoved&lt;/span&gt; and &lt;span class="code"&gt;onMouseWheelMoved&lt;/span&gt; handlers call appropriate functions to maintain the mouse position and scaling factor variables. These functions are:
&lt;pre class="brush: javafx"&gt;
function updateMousePosition(me : MouseEvent) {
  mouseX = me.x;
  mouseY = me.y;
}

function updateScale(we: MouseEvent) : Void {
  var rotation = we.wheelRotation;
  // Control-Shift zoom-out scales back to MINIMUM_SCALE
  if (we.controlDown and we.shiftDown and rotation &amp;gt; 0) {
    scale = MINIMUM_SCALE;
    return;
  }
  var newScale = scale - (rotation * SCALING_INCREMENT);
  // Don't allow scaling below MINIMUM_SCALE
  if (newScale &amp;lt; MINIMUM_SCALE) {
    scale = MINIMUM_SCALE;
    return;
  }
  scale = newScale;
}
&lt;/pre&gt;The mouse coordinates &lt;span class="code"&gt;mouseX&lt;/span&gt; and &lt;span class="code"&gt;mouseY&lt;/span&gt; are kept up-to-date in &lt;span class="code"&gt;updateMousePosition()&lt;/span&gt;. The &lt;span class="code"&gt;updateScale()&lt;/span&gt; function adjusts the scaling factor according to the sign and number of mouse wheel rotation units. If the Control and Shift key modifiers are enabled on the mouse event, &lt;span class="code"&gt;scale&lt;/span&gt; is reset to its minimum value. A check ensures that less-than-unity scaling is not allowed.
&lt;br /&gt;
&lt;br /&gt;
Unfortunately, JavaFX applets are not immune to the annoying Windows behavior that plagued my previous applets. When the applet is first displayed on a page, it won't listen to mouse wheel events. But if a tooltip or popup menu is displayed and then hidden, mouse wheel events become active. Here is the hack to get this working:
&lt;pre class="brush: javafx"&gt;
function windowsHack() {
  // simulate right-mouse click to bring-up popup menu
  chartPanel.mousePressed(new java.awt.event.MouseEvent(chartPanel,
    0, 0,
    java.awt.event.InputEvent.BUTTON3_DOWN_MASK,
    0, 0, 1, true));
  // immediately hide the popup menu
  chartPanel.getPopupMenu().setVisible(false);
}
&lt;/pre&gt;The &lt;span class="code"&gt;onMouseEntered&lt;/span&gt; function calls the above method the first time the mouse hovers over the applet. A right-click is simulated and a popup menu is shown and immediately hidden. This hack only fixes the situation when the applet is first displayed in the browser. If the applet is dragged out of the browser and then returned to the browser, the user will have to manually right-click and dismiss the popup menu in order to restore correct mouse wheel behavior.



&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;JavaFX&lt;/span&gt;

&lt;br /&gt;
Unlike my previous applets, this applet does not require Java SE 6. I do not use &lt;a href="https://jxlayer.dev.java.net/" target="_new"&gt;JXLayer&lt;/a&gt; or any other nifty Swing libraries; therefore, it will run on J2SE 5.0. This is the latest version of Java that will run applets within a web browser on my 32-bit Intel Mac, so testing is much easier than before. Performance does suffer on Java versions prior to SE 6 update 10, but not significantly due to the simplicity of this applet.
&lt;br /&gt;
&lt;br /&gt;

As a first impression, I'm quite pleased with the ability to get so much out of so few lines of code. It is nice not having to write listeners and just letting the bindings take care of everything. I look forward to working with JavaFX on future projects.
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"  &gt;Resources&lt;/span&gt;
&lt;br /&gt;
To build the applet, you will need these:
&lt;ol&gt;&lt;li&gt;My &lt;a href="http://patrickwebster.synthasite.com/resources/JFreeChartScalableScrollable.zip"&gt;code&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;JFreeChart &lt;a href="http://sourceforge.net/projects/jfreechart/files/1.%20JFreeChart/1.0.12/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.12)
&lt;/li&gt;&lt;li&gt;JFree JCommon &lt;a href="http://sourceforge.net/projects/jfreechart/files/3.%20JCommon/1.0.15/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.15)
&lt;/li&gt;&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-8011427563511522749?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/8011427563511522749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/03/scalable-jfreechart-javafx-applet.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8011427563511522749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/8011427563511522749'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/03/scalable-jfreechart-javafx-applet.html' title='Scalable JFreeChart JavaFX Applet'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-640276616620435272</id><published>2009-02-27T20:29:00.000-08:00</published><updated>2009-05-30T11:41:56.079-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Explorer'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='Blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='clipboard'/><category scheme='http://www.blogger.com/atom/ns#' term='highlight'/><category scheme='http://www.blogger.com/atom/ns#' term='highlighter'/><category scheme='http://www.blogger.com/atom/ns#' term='template'/><category scheme='http://www.blogger.com/atom/ns#' term='source'/><category scheme='http://www.blogger.com/atom/ns#' term='pre'/><category scheme='http://www.blogger.com/atom/ns#' term='blank'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><category scheme='http://www.blogger.com/atom/ns#' term='Bush'/><category scheme='http://www.blogger.com/atom/ns#' term='format'/><category scheme='http://www.blogger.com/atom/ns#' term='generics'/><category scheme='http://www.blogger.com/atom/ns#' term='code'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='SyntaxHighlighter'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>SyntaxHighlighter in Blogger</title><content type='html'>If you want to display well-formatted and easy-to-read source code in your Blogger blog, you may want to used Alex Gorbatchev's &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter" target="_new"&gt;SyntaxHighlighter&lt;/a&gt;. Here is a sample of formatted Java:
&lt;pre class="brush: java"&gt;
public @interface Politics {}

@Override
public final void liveInAmerica(boolean insane) {
  Party&amp;lt;Fool&amp;gt;    republican = new Party&amp;lt;Fool&amp;gt;(false);
  // Party like it's 1999!
  Party&amp;lt;Dude&amp;gt; nonRepublican = new Party&amp;lt;Dude&amp;gt;(true);
  while(isBush()) {
    suffer(13);
  }
  if(insane) {
    elect(republican);
  }
  else {
    System.out.println("Free at last!");
    elect(nonRepublican);
    beHappy(7);
  }
}
&lt;/pre&gt;In order to display my Java code, I perform the following three steps:
&lt;ol&gt;&lt;li&gt;Add CSS styles and a JavaScript to the Blogger template.&lt;/li&gt;&lt;li&gt;Make source code more HTML friendly.
&lt;/li&gt;&lt;li&gt;Wrap code in &amp;lt;pre&amp;gt; tag when posting.&lt;/li&gt;&lt;/ol&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Step 1: Modify Template&lt;/span&gt;
&lt;br /&gt;
In Blogger's Layout tab, select the &amp;#147Edit HTML&amp;#148 sub-tab. Locate &amp;lt;/head&amp;gt; in the text area. Right BEFORE this tag (before the &amp;lt;), paste the following code.
&lt;blockquote&gt;&amp;lt;link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/&amp;gt;
&amp;lt;link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/&amp;gt;
&amp;lt;script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/&amp;gt;
&amp;lt;script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/&amp;gt;
&amp;lt;script type='text/javascript'&amp;gt;
SyntaxHighlighter.config.clipboardSwf = &amp;amp;#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&amp;amp;#39;;
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
&amp;lt;/script&amp;gt;
&lt;/blockquote&gt;Click the SAVE TEMPLATE button. If no errors occurred, you may navigate away from the Layout tab. This step only needs to be performed once. For each subsequent blog post, you only need to do the remaining steps to get highlighted source code.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Step 2: Clean the Code&lt;/span&gt;
&lt;br /&gt;
Java code that uses generics contains lots of less-than (&amp;lt;) and greater-than (&amp;gt;) symbols. These symbols confuse HTML renderers. So the generified Java must be converted to a more friendly format. That is, each less-than and greater-than symbol needs to be replaced with &amp;#147&amp;amp;lt;&amp;#148 and &amp;#147&amp;amp;gt;&amp;#148 (without the quotation marks,) respectively. I use an &lt;a href="http://www.dan.co.jp/cases/javascript/encode_entities.html" target="_new"&gt;online HTML encoder&lt;/a&gt; to quickly format the code. There are many other tools that achieve the same result.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Step 3: Wrap Code in &amp;lt;pre&amp;gt; Tag&lt;/span&gt;
&lt;br /&gt;
Precede each block of Java code with the following:
&lt;blockquote&gt;&amp;lt;pre class="brush: java"&amp;gt;&lt;/blockquote&gt;Finish the code block with:
&lt;blockquote&gt;&amp;lt;/pre&amp;gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;" &gt;Blank Lines in IE&lt;/span&gt;
&lt;br /&gt;
In order for Blogger to display blank lines within highlighted source code on Internet Explorer, one additional setting must be adjusted. Under the Settings tab, in the Formatting sub-tab, the option &amp;#147Convert line breaks&amp;#148 must be changed to &amp;#147No.&amp;#148 With this setting, hard-returns typed in the WYSIWYG post editor will not be converted to HTML line break tags.
&lt;br /&gt;
&lt;br /&gt;
WARNING: changing this option from yes to no will reformat all posts. If you don't want to spend forever re-entering all line breaks in your existing posts, then you may want to live without blank lines in your highlighted source code. But if you only have a few posts, then it is worth the reformatting exercise. Blank lines can make long source code listings much more readable. Keep in mind that the WYSIWYG &amp;#147Compose&amp;#148 editor will be basically useless after changing this option to &amp;#147No.&amp;#148 All line breaks will have to be entered as &lt;span class="code"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt; tags in the &amp;#147Edit Html&amp;#148 editor, or a third-party blog editor.

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Other Languages&lt;/span&gt;
&lt;br /&gt;
The brush option in the &lt;span class="code"&gt;&amp;lt;pre&amp;gt;&lt;/span&gt; tag tells SyntaxHighlighter which language to use. If you want to post source code in other languages, you would need to change the brush type in the &lt;span class="code"&gt;&amp;lt;pre&amp;gt;&lt;/span&gt; tag and add the appropriate language script to your Blogger template. I only use Java, so I only added the Java script. It is a good idea to add as few JavaScripts as possible to your template in order to minimize page load times. You may choose from a complete &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Brushes" target="_new"&gt;list&lt;/a&gt; of supported languages and add the appropriate script line to your template for each desired language. For example, to add C++ support to your blog, add the following line to your template:
&lt;blockquote&gt;&amp;lt;script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/&amp;gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;SyntaxHighlighter Usage&lt;/span&gt;
&lt;br /&gt;
In order for the &amp;#147copy to clipboard&amp;#148 feature to work, the blog viewer must have the &lt;a href="http://www.adobe.com/go/getflashplayer" target="_new"&gt;Flash&lt;/a&gt; plugin installed. Without the appropriate Flash plugin, a blank area will be displayed where the clipboard button is usually located.
&lt;br /&gt;
&lt;br /&gt;
If you wish to host the SyntaxHighlighter scripts on your own site and not rely on the developer's server, you can find more information &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter:Usage" target="_new"&gt;here&lt;/a&gt;. It is preferred that you host SyntaxHighlighter on your own server in order to conserve the developer's hosting bandwidth.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-640276616620435272?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/640276616620435272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/02/syntaxhighlighter-in-blogger.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/640276616620435272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/640276616620435272'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/02/syntaxhighlighter-in-blogger.html' title='SyntaxHighlighter in Blogger'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-232390588368212328</id><published>2009-02-01T01:14:00.000-08:00</published><updated>2009-06-18T02:57:59.174-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='update-alternatives'/><category scheme='http://www.blogger.com/atom/ns#' term='plugin'/><category scheme='http://www.blogger.com/atom/ns#' term='dragging'/><category scheme='http://www.blogger.com/atom/ns#' term='Xfce'/><category scheme='http://www.blogger.com/atom/ns#' term='Sir Mix-a-Lot'/><category scheme='http://www.blogger.com/atom/ns#' term='Xubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='update 10'/><category scheme='http://www.blogger.com/atom/ns#' term='Ubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='Firefox'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='drag'/><category scheme='http://www.blogger.com/atom/ns#' term='Baby Got Back'/><category scheme='http://www.blogger.com/atom/ns#' term='Intrepid'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='galternatives'/><category scheme='http://www.blogger.com/atom/ns#' term='G Alternatives'/><category scheme='http://www.blogger.com/atom/ns#' term='Kubuntu'/><category scheme='http://www.blogger.com/atom/ns#' term='libnpjp2.so'/><category scheme='http://www.blogger.com/atom/ns#' term='browser'/><title type='text'>Dragging Applets Out of the Browser in Xubuntu (Intrepid Ibex)</title><content type='html'>Java SE 6 Update 10 provides the ability to drag applets out of the browser. The two steps necessary to enable this functionality in Xubuntu 8.10 (Intrepid Ibex) are:

&lt;ol&gt;&lt;li&gt;Change the window-dragging keyboard shortcut in your window manager.&lt;/li&gt;&lt;li&gt;Update the outdated java plugin links.&lt;/li&gt;&lt;/ol&gt;

The second step is only necessary before upgrading to Java SE 6 Update 11, which has already been released as an automatic update in Windows, but has yet to appear automatically in the Ubuntu flavors of linux. (Actually, Update 12 has already been released.) The first step will be explained below using the Xfce desktop environment in Xubuntu 8.10 (Intrepid Ibex). The remaining step applies to other Ubuntu flavors as well (Kubuntu, Edubuntu, etc.).
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Step 1: Changing the Window Dragging Key&lt;/span&gt;
&lt;br /&gt;
In Xfce, bring up the Settings -&gt; Settings Manager. Click on &amp;#147Window Manager Tweaks&amp;#148 and go to the &amp;#147Accessibility&amp;#148 tab. Change the &amp;#147Key used to grab and move windows&amp;#148 to anything but &lt;span style="font-weight: bold;"&gt;Alt&lt;/span&gt;. In the image below, &lt;span style="font-weight: bold;"&gt;Super&lt;/span&gt; is chosen:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Lw-ycwOYOvU/SZFGZf1GfgI/AAAAAAAAABQ/p5-OTvl5bug/s1600-h/1_window_manager_tweaks.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 314px; height: 400px;" src="http://3.bp.blogspot.com/_Lw-ycwOYOvU/SZFGZf1GfgI/AAAAAAAAABQ/p5-OTvl5bug/s400/1_window_manager_tweaks.png" alt="" id="BLOGGER_PHOTO_ID_5301095640246681090" border="0" /&gt;&lt;/a&gt;(For instructions on how to do this in GNOME, see Cay Horstmann's &lt;a href="http://weblogs.java.net/blog/cayhorstmann/archive/2008/09/applet_dragging.html" target="_new"&gt;blog&lt;/a&gt;.)
&lt;br /&gt;
If Java 6 Update 11 or later is installed, applying the new key shortcut above should enable applet dragging and the remaining steps should not be necessary.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Step 2: Update the Java Plugin Link&lt;/span&gt;
&lt;br /&gt;
I will present two methods for updating the links to the java plugin. The first uses the graphical user interface tool &lt;span style="font-weight: bold;"&gt;G Alternatives&lt;/span&gt;, and the second uses the command-line tool &lt;span class="code"&gt;update-alternatives&lt;/span&gt;.
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;GUI Method&lt;/span&gt;
&lt;br /&gt;
First, install &lt;span style="font-weight: bold;"&gt;G Alternatives&lt;/span&gt; using the following command:
&lt;br /&gt;
&lt;blockquote&gt;&lt;span class="code"&gt;sudo apt-get install galternatives&lt;/span&gt;&lt;/blockquote&gt;
Launch the program with root access:
&lt;blockquote&gt;&lt;span class="code"&gt;sudo galternatives &amp;amp;&lt;/span&gt;&lt;/blockquote&gt;
Scroll down to the bottom of the Alternatives list on the left side and select &amp;#147xulrunner-1.9-javaplugin.so&amp;#148 as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Lw-ycwOYOvU/SZFIIOa_92I/AAAAAAAAABY/vE9J4lbsZt4/s1600-h/2_xulrunner_before.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 181px;" src="http://3.bp.blogspot.com/_Lw-ycwOYOvU/SZFIIOa_92I/AAAAAAAAABY/vE9J4lbsZt4/s400/2_xulrunner_before.png" alt="" id="BLOGGER_PHOTO_ID_5301097542539278178" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
Select &amp;#147auto&amp;#148 in the Status chooser. The Options table shows only one choice with priority 63. This is the location of the &lt;span style="font-weight: bold;"&gt;old&lt;/span&gt; plugin. To add the updated plugin, click &amp;#147Add&amp;#148 and paste this path in the dialog:
&lt;blockquote&gt;&lt;span class="code" &gt;/usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so&lt;/span&gt;&lt;/blockquote&gt;Only valid file paths are allowed. So don't worry about typing the wrong value and screwing up your system. If you make a mistake in the library path, you can browse to the correct location. Enter a priority larger than the priority of the old plugin (or any other plugins in the Options table). I chose 77 as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SZFI8rysD4I/AAAAAAAAABg/yGQDtlcrEJ0/s1600-h/3_adding_option.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 365px; height: 142px;" src="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SZFI8rysD4I/AAAAAAAAABg/yGQDtlcrEJ0/s400/3_adding_option.png" alt="" id="BLOGGER_PHOTO_ID_5301098443776462722" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
Clicking OK should produce something like this:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SZFJGPFpB0I/AAAAAAAAABo/WKfbXXKMQKo/s1600-h/4_xulrunner_after.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 181px;" src="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SZFJGPFpB0I/AAAAAAAAABo/WKfbXXKMQKo/s400/4_xulrunner_after.png" alt="" id="BLOGGER_PHOTO_ID_5301098607870019394" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
Notice that the new plugin is automatically chosen in the Choice column. This is because the auto status will automatically select the alternative with the highest priority. At this point, the system is updated. Without closing G Alternatives, launch a new Firefox browser and test if applet dragging is enabled. For my freshly installed Xubuntu system, this was all that was necessary for Firefox to start using the new plugin.
&lt;br /&gt;
&lt;br /&gt;
If applet dragging still does not work, close Firefox and return to G Alternatives. Scroll up in the list of alternatives to &amp;#147mozilla-javaplugin.so,&amp;#148 as shown here:
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SZFJZtmILeI/AAAAAAAAABw/yiSgZmKYn3Q/s1600-h/5_mozilla_before.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 181px;" src="http://2.bp.blogspot.com/_Lw-ycwOYOvU/SZFJZtmILeI/AAAAAAAAABw/yiSgZmKYn3Q/s400/5_mozilla_before.png" alt="" id="BLOGGER_PHOTO_ID_5301098942476856802" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
Select &amp;#147auto&amp;#148 status if is it not already selected. Add a new option with the same path and priority as the XULRunner case above. Choose a priority larger than any other options in the table. In my case, I again chose 77 because it is larger than the highest-priority alternative option (63).
&lt;br /&gt;
&lt;br /&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SZFJhjnvplI/AAAAAAAAAB4/6BRDbgfrCiA/s1600-h/6_mozilla_after.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 181px;" src="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SZFJhjnvplI/AAAAAAAAAB4/6BRDbgfrCiA/s400/6_mozilla_after.png" alt="" id="BLOGGER_PHOTO_ID_5301099077238236754" border="0" /&gt;&lt;/a&gt;
&lt;br /&gt;
Without closing G Alternatives, test Firefox again. On my Kubuntu system, changing both the XULRunner and Mozilla Java plugins was sufficient to correct the plugin behavior in Firefox.
&lt;br /&gt;
&lt;br /&gt;
Once you have applet dragging working properly, you may quit. But a cleaner solution is to update &lt;span style="font-weight: bold;"&gt;all&lt;/span&gt; links to the old Java plugin. Sun &lt;a href="https://jdk6.dev.java.net/plugin2/#INSTALLATION" target="_new"&gt;recommends&lt;/a&gt; removing all links to the old java plugin. The list of remaining plugins that should be updated is:
&lt;br /&gt;
&lt;blockquote&gt;&lt;span class="code" &gt;
firefox-javaplugin.so&lt;br /&gt;
iceape-javaplugin.so&lt;br /&gt;
iceweasel-javaplugin.so&lt;br /&gt;
midbrowser-javaplugin.so&lt;br /&gt;
xulrunner-javaplugin.so&lt;/span&gt;&lt;/blockquote&gt;The procedure to update these libraries is identical to the previous examples. Select each one and add a new path to the updated plugin with top priority and auto status.
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Command-Line Method&lt;/span&gt;
&lt;br /&gt;
The following achieves the same result as the GUI method above. The command &lt;span class="code" &gt;update-alternatives&lt;/span&gt; will be used to make Firefox see the correct XULRunner library. To display the current library pointed to by the XULRunner link, execute the following:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --display xulrunner-1.9-javaplugin.so&lt;/span&gt;&lt;/blockquote&gt;The output should look something like this:
&lt;blockquote&gt;&lt;span class="code" &gt;xulrunner-1.9-javaplugin.so - status is auto.&lt;br /&gt;
link currently points to /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so&lt;br /&gt;
/usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so - priority 63&lt;br /&gt;
Current `best' version is /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so.&lt;/span&gt;
&lt;/blockquote&gt;This says that the library &lt;span class="code" &gt;xulrunner-1.9-javaplugin.so&lt;/span&gt; points to the &lt;span style="font-weight: bold;"&gt;old&lt;/span&gt; plugin &lt;span class="code" &gt;libjavaplugin_oji.so&lt;/span&gt; with auto-selected priority 63. If status is manual, set it to auto with the following command:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --auto xulrunner-1.9-javaplugin.so&lt;/span&gt;
&lt;/blockquote&gt;We want to install a link to the new plugin with a priority greater than 63. The following will achieve this:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --install /usr/lib/xulrunner-1.9.0.5/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;/span&gt;&lt;/blockquote&gt;(You may have a slightly different version, like 1.9.0.4. If so, edit the command appropriately.)
&lt;br /&gt;
&lt;br /&gt;
Checking the display with
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --display xulrunner-1.9-javaplugin.so&lt;/span&gt;&lt;/blockquote&gt;produces:
&lt;blockquote&gt;&lt;span class="code" &gt;xulrunner-1.9-javaplugin.so - status is auto.&lt;br /&gt;
 link currently points to /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so&lt;br /&gt;
/usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so - priority 63&lt;br /&gt;
/usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so - priority 77&lt;br /&gt;
Current `best' version is /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so.&lt;/span&gt;&lt;/blockquote&gt;So now the link points to the new plugin with priority 77, making it the best and current link. Launch a new Firefox and test if applet dragging works. If not, update the &lt;span class="code" &gt;mozilla-javaplugin.so&lt;/span&gt; library in a similar manner. First, execute the following:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --display mozilla-javaplugin.so&lt;/span&gt;&lt;/blockquote&gt;The output should look something like this:
&lt;blockquote&gt;&lt;span class="code" &gt;mozilla-javaplugin.so - status is auto.&lt;br /&gt;
 link currently points to /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so&lt;br /&gt;
/usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so - priority 63&lt;br /&gt;
Current `best' version is /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so.&lt;/span&gt;
&lt;/blockquote&gt;This is nearly identical to the XULRunner case above. Set the status to auto if necessary:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --auto mozilla-javaplugin.so&lt;/span&gt;&lt;/blockquote&gt;Install the new alternative:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;/span&gt;&lt;/blockquote&gt;That should fix applet dragging. But for the cleanest solution, Sun &lt;a href="https://jdk6.dev.java.net/plugin2/#INSTALLATION" target="_new"&gt;recommends&lt;/a&gt; updating the following libraries as follows:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo update-alternatives --install /usr/lib/firefox/plugins/libjavaplugin.so firefox-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;br /&gt;
sudo update-alternatives --install /usr/lib/iceape/plugins/libjavaplugin.so iceape-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;br /&gt;
sudo update-alternatives --install /usr/lib/iceweasel/plugins/libjavaplugin.so iceweasel-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;br /&gt;
sudo update-alternatives --install /usr/lib/midbrowser/plugins/libjavaplugin.so midbrowser-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;br /&gt;
sudo update-alternatives --install /usr/lib/xulrunner/plugins/libjavaplugin.so xulrunner-javaplugin.so /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so 77&lt;/span&gt;
&lt;/blockquote&gt;Make sure they all have auto status and 77 is the highest priority.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"&gt;Last Resort&lt;/span&gt;
&lt;br /&gt;
If updating &lt;span class="code" &gt;/etc/alternatives/&lt;/span&gt; still does not fix applet dragging in Firefox 3, you may try fiddling with links directly, but this may cause problems later when upgrading.
&lt;br /&gt;
&lt;br /&gt;
There are several places where Firefox 3 looks for Java plugins. One place is &lt;span class="code" &gt;/usr/lib/firefox-addons/plugins/&lt;/span&gt;. Place a link to the updated plugin in this directory using the following command:
&lt;blockquote&gt;&lt;span class="code" &gt;sudo ln -s /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so /usr/lib/firefox-addons/plugins/sir_mix_a_lot&lt;/span&gt;&lt;/blockquote&gt;You may question the name of the above link. I chose this name to make the point that the name does not matter. Firefox will follow the link and load the plugin that it points to. The important thing to learn is that because names do not matter, &lt;span style="font-weight: bold;"&gt;RENAMING A PLUGIN WILL NOT DISABLE IT&lt;/span&gt;. If you want to remove a plugin, &lt;span style="font-weight: bold;"&gt;MOVE IT OR LOSE IT!&lt;/span&gt; You should probably rename the link to something more traditional, like &amp;#147&lt;span class="code" &gt;libnpjp2.so&lt;/span&gt;.&amp;#148
&lt;br /&gt;
&lt;br /&gt;
Note that the directory &lt;span class="code" &gt;/usr/lib/firefox/plugins/&lt;/span&gt; is NOT the right place to fix applet dragging in Firefox 3. You can modify that directory all you want and it won't help. It may be a good idea to remove the old library link named &amp;#147&lt;span class="code" &gt;libjavaplugin.so&lt;/span&gt;&amp;#148 which points to &lt;span class="code" &gt;/usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so&lt;/span&gt; which is the &lt;span style="font-weight: bold;"&gt;old&lt;/span&gt; plugin. Sun &lt;a href="https://jdk6.dev.java.net/plugin2/#INSTALLATION" target="_new"&gt;recommends&lt;/a&gt; removing all links to the old library. But removing this link is not necessary to enable applet dragging.
&lt;br /&gt;
&lt;br /&gt;
Another place to update the Firefox plugin is in the user's home directory. If the directory &lt;span class="code" &gt;~/.mozilla/plugins/&lt;/span&gt; does not exist (it didn't exist on my machine), create it and execute the following command:
&lt;blockquote&gt;&lt;span class="code" &gt;ln -s /usr/lib/jvm/java-6-sun/jre/lib/i386/libnpjp2.so ~/.mozilla/plugins/baby_got_back&lt;/span&gt;&lt;/blockquote&gt;Once again, the name of the link does not matter. You may choose the name &amp;#147&lt;span class="code" &gt;libnpjp2.so&lt;/span&gt;&amp;#148 if you like.
&lt;br /&gt;
&lt;br /&gt;
So that is what worked for me. Your mileage may vary.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-232390588368212328?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/232390588368212328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/02/dragging-applets-out-of-browser-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/232390588368212328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/232390588368212328'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/02/dragging-applets-out-of-browser-in.html' title='Dragging Applets Out of the Browser in Xubuntu (Intrepid Ibex)'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Lw-ycwOYOvU/SZFGZf1GfgI/AAAAAAAAABQ/p5-OTvl5bug/s72-c/1_window_manager_tweaks.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-2510739572275712096</id><published>2009-01-21T05:40:00.000-08:00</published><updated>2010-07-05T17:07:49.391-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Demo'/><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='zoom'/><category scheme='http://www.blogger.com/atom/ns#' term='JFreeChart'/><category scheme='http://www.blogger.com/atom/ns#' term='update 10'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='scroll'/><category scheme='http://www.blogger.com/atom/ns#' term='JXLayer'/><category scheme='http://www.blogger.com/atom/ns#' term='wheel'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='Swing'/><category scheme='http://www.blogger.com/atom/ns#' term='Scalable'/><category scheme='http://www.blogger.com/atom/ns#' term='Zoomable'/><title type='text'>Scalable JFreeChart Applet</title><content type='html'>I created a new applet that allows one to scale a &lt;a href="http://www.jfree.org/jfreechart/" target="_new"&gt;JFreeChart&lt;/a&gt; using the mouse scroll wheel. I use the term &amp;#147scale&amp;#148 rather than &amp;#147zoom&amp;#148 because JFreeChart already has a well-defined interface for zooming, and it is not the same behavior as my scaling. In the applet below, scrolling up will &amp;#147zoom in&amp;#148 or magnify the view at the cursor position. Scrolling down &amp;#147zooms out&amp;#148 centered at the cursor. The behavior is similar to the Mac OS X Universal Access Zoom behavior, which when enabled, allows the user to zoom in and out at the cursor position while holding the Control key and scrolling with the mouse wheel. To quickly get back to the original scaling, hold down the Control and Shift keys and scroll down.
&lt;br /&gt;
&lt;br /&gt;

&lt;script type="text/javascript"&gt;
  &lt;!--
  function startApplet() {
    appletsource='&lt;applet code="demo.jfreechart.scale.JXLayerScaleDemo" codebase="http://27.appspot.com/java/lib" archive="jfreechart-scaler-applet.jar,jfreechart-1.0.12.jar,jcommon-1.0.15.jar,jxlayer.jar" alt="Dude, like you totally need Java SE 6 or later to run this applet." height="288" width="466"&gt;\n'; 
    appletsource+='&lt;param name="draggable" value="true"&gt;\n';
    appletsource+='&lt;param name="java_arguments" value="-Djnlp.packEnabled=true"&gt;\n'; 
    appletsource+='&lt;/applet&gt;\n'; 
    document.getElementById('appletdiv').innerHTML=appletsource;
  }
  //--&gt;
&lt;/script&gt;

&lt;div id="appletdiv" style="text-align: center;"&gt;
  &lt;input type="image" src="http://patrickwebster.synthasite.com/resources/scaler-applet.png" alt="Click here to start applet." onmousedown="startApplet()" /&gt;
&lt;/div&gt;

&lt;span style=";font-size:78%;"&gt;
Note for Windows users: if the scaling does not work or quits working, right-click to bring-up a popup menu, then click anywhere on the applet to dismiss the popup. I discussed this bug in a &lt;a href="http://patrickwebster.blogspot.com/2009/01/jfreechart-and-jxlayer-adjustable.html" target="_new"&gt;previous post&lt;/a&gt;.
&lt;/span&gt;

&lt;br /&gt;
&lt;br /&gt;

&lt;span style="font-weight: bold;font-size:130%;"  &gt;The Code&lt;/span&gt;
&lt;br /&gt;

The scaling is an extension of the generic &lt;a href="http://www.pbjar.org/blogs/jxlayer/JXLayer_two.html" target="_new"&gt;ZoomUI&lt;/a&gt; by &lt;a href="http://www.pbjar.org/" target="_new"&gt;Piet Blok&lt;/a&gt;, which is built on &lt;a href="https://jxlayer.dev.java.net/" target="_new"&gt;JXLayer&lt;/a&gt;. Specifically, I extend two classes. My &lt;span class="code"&gt;WheelZoomableUI&lt;/span&gt; class extends &lt;span class="code"&gt;ZoomUI&lt;/span&gt;, and &lt;span class="code"&gt;WheelZoomablePort&lt;/span&gt; extends &lt;span class="code"&gt;ZoomPort&lt;/span&gt;. The &lt;span class="code"&gt;WheelZoomableUI&lt;/span&gt; class contains only one method that overrides &lt;span class="code"&gt;transformMouseWheelEvent(...)&lt;/span&gt;. That method calls the appropriate scaling algorithms in the corresponding &lt;span class="code"&gt;WheelZoomablePort&lt;/span&gt; class.
&lt;br /&gt;
&lt;br /&gt;
The scaling is performed by applying appropriate scaling and translation transformations to the &lt;span class="code"&gt;AffineTransform&lt;/span&gt; field in the &lt;span class="code"&gt;ZoomPort&lt;/span&gt; class. When zooming in, the operation is quite simple. First, the &lt;span class="code"&gt;AffineTransform.scale(...)&lt;/span&gt; transformation applies the scaling. Then, the cursor position in the view is converted to the &amp;#147unscaled&amp;#148 coordinate system. This position is then used to translate the view so that the &amp;#147zoomed-in&amp;#148 point is centered at the original mouse cursor position. This simply means that the content under the cursor remains in the same position while scaling.
&lt;br /&gt;
&lt;br /&gt;
Zooming out requires one additional step. After the above scaling and translation have been applied, it is possible that part of the chart has fallen off the edge of the view. Another way of describing this is that the user zoomed-out so far that the chart has &amp;#147slid over&amp;#148 toward the cursor. This results in a blank area in the applet window. In order to avoid this blank area, the chart needs to be &amp;#147slid back&amp;#148 to cover the blank area. So a corrective translation is applied to ensure that no part of the view is empty.
&lt;br /&gt;
&lt;br /&gt;
The minimum scaling allowed is 1.0, meaning that one cannot make the chart smaller than the applet panel size. So no blank areas are possible in the applet. If you observe my &lt;a href="http://patrickwebster.blogspot.com/2009/01/jfreechart-and-jxlayer-adjustable.html"&gt;magnifier applet&lt;/a&gt;, it is possible to zoom out to a scaling factor less than 1.0. This creates a blue area within the magnifying glass that shows the area outside the chart. This blue area corresponds to the empty area described above that necessitates the corrective translation when zooming out.
&lt;br /&gt;
&lt;br /&gt;
Constructing the applet is quite simple, as seen here:
&lt;pre class="brush: java"&gt;
public JXLayerScaleDemo() {
  super();
  XYDataset dataset = createDataset();
  JFreeChart chart = createChart(dataset);
  chartPanel = new ChartPanel(chart);
  final WheelZoomablePort zoomPort = new WheelZoomablePort();
  final WheelZoomableUI zoomUI = new WheelZoomableUI();
  zoomPort.setView(chartPanel);
  zoomPort.setOpaque(true);
  final JXLayer&amp;lt;ZoomPort&amp;gt; layer = new JXLayer&amp;lt;ZoomPort&amp;gt;(zoomPort, zoomUI);
  chartPanel.setPreferredSize(new java.awt.Dimension(480, 260));
  setContentPane(layer);
}

&lt;/pre&gt;Instances of the &lt;span class="code"&gt;WheelZoomablePort&lt;/span&gt; and &lt;span class="code"&gt;WheelZoomableUI&lt;/span&gt; are created from the default constructors. The view of the port is set to the chart panel. Then the port and UI are sent to the &lt;span class="code"&gt;JXLayer&lt;/span&gt; constructor. The &lt;span class="code"&gt;JXLayer&lt;/span&gt; is then set as the main content.
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"  &gt;Future Work&lt;/span&gt;
&lt;br /&gt;
As mentioned above, the wheel zoomer behaves similarly to the Mac OS X Universal Access Zoom, but with one important omission. When zoomed-in, the user cannot pan and explore the hidden parts of the panel. Luckily, JXLayer already has a nice UI to handle panning and scrolling called &lt;span class="code"&gt;MouseScrollableUI&lt;/span&gt;. I hope to add this functionality in the future.
&lt;br /&gt;
&lt;br /&gt;
From a coding perspective, it is not really necessary to subclass ZoomUI and ZoomPort. It may be better to simply add a MouseWheelListener to the ZoomPort and override the &lt;span class="code"&gt;mouseWheelMoved&lt;/span&gt; method. In fact, the test classes in the ZoomUI and the new &lt;a href="http://www.pbjar.org/blogs/jxlayer/version_2/" target="_new"&gt;TransformUI&lt;/a&gt; packages do just this to achieve similar scaling behavior without subclassing.
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;"  &gt;Resources&lt;/span&gt;
&lt;br /&gt;
To build the applet, you will need these:
&lt;ol&gt;&lt;li&gt;My &lt;a href="http://patrickwebster.synthasite.com/resources/jfreechart-scaler-applet_src.tar.gz"&gt;code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;JXLayer &lt;a href="http://download.java.net/maven/2/org/swinglabs/jxlayer/3.0/jxlayer-3.0.jar"&gt;library&lt;/a&gt; (I use version 3.0)
&lt;/li&gt;&lt;li&gt;JFreeChart &lt;a href="http://sourceforge.net/projects/jfreechart/files/1.%20JFreeChart/1.0.12/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.12)
&lt;/li&gt;&lt;li&gt;JFree JCommon &lt;a href="http://sourceforge.net/projects/jfreechart/files/3.%20JCommon/1.0.15/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.15)
&lt;/li&gt;&lt;/ol&gt; The first link above is a modified subset of Piet Blok's generic &lt;a href="http://www.pbjar.org/blogs/jxlayer/PBZoom_src.zip"&gt;ZoomUI&lt;/a&gt; released on January 11th, 2009.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-2510739572275712096?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/2510739572275712096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/01/scalable-jfreechart-applet.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/2510739572275712096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/2510739572275712096'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/01/scalable-jfreechart-applet.html' title='Scalable JFreeChart Applet'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-4733008230168933953</id><published>2009-01-13T03:56:00.000-08:00</published><updated>2010-07-05T17:16:18.345-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Demo'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='Magnifier'/><category scheme='http://www.blogger.com/atom/ns#' term='JXLayer'/><category scheme='http://www.blogger.com/atom/ns#' term='JFreeChart'/><category scheme='http://www.blogger.com/atom/ns#' term='Zoomable'/><category scheme='http://www.blogger.com/atom/ns#' term='Scalable'/><title type='text'>JFreeChart and JXLayer Adjustable Magnifier</title><content type='html'>&lt;a href="https://jxlayer.dev.java.net/" target="_new"&gt;JXLayer&lt;/a&gt; is cool. I &lt;a href="http://patrickwebster.blogspot.com/2008/12/jxlayer-with-jfreechart-application-not.html"&gt;wrote&lt;/a&gt; about Dave Gilbert's &lt;a href="http://www.jroller.com/dgilbert/entry/jfreechart_and_jxlayer" target="_new"&gt;demo applet&lt;/a&gt; that uses JXLayer and Piet Blok's &lt;a href="http://www.pbjar.org/blogs/jxlayer/JXLayer_one.html" target="_new"&gt;work&lt;/a&gt; to show a magnifying glass over a JFreeChart. Since then Piet has &lt;a href="http://www.pbjar.org/blogs/jxlayer/JXLayer_two.html" target="_new"&gt;updated&lt;/a&gt; his MagnifierUI code and I extended it into a more configurable magnifying glass. In the applet below, you should be able to use your mouse wheel to adjust the magnification factor of the magnifying glass. Also, while holding down the Control and Shift keys, the mouse wheel should adjust the size of the magnifying glass.
&lt;br /&gt;
&lt;br /&gt;

&lt;script type="text/javascript"&gt;
  &lt;!--
  function startApplet() {
    appletsource='&lt;applet code="JFreeChartMagnifierApplet" codebase="http://apppspot.appspot.com/java/lib" archive="jfreechart-magnifier-applet.jar,jfreechart-1.0.12.jar,jcommon-1.0.15.jar,jxlayer.jar" alt="Dude, like you totally need Java SE 6 or later to run this applet." height="288" width="466"&gt;\n'; 
    appletsource+='&lt;param name="draggable" value="true"&gt;\n';
    appletsource+='&lt;param name="java_arguments" value="-Djnlp.packEnabled=true"&gt;\n'; 
    appletsource+='&lt;/applet&gt;\n'; 
    document.getElementById('appletdiv').innerHTML=appletsource;
  }
  //--&gt;
&lt;/script&gt;

&lt;div id="appletdiv" style="text-align: center;"&gt;
  &lt;input type="image" src="http://patrickwebster.synthasite.com/resources/magnifier-applet.png" alt="Click here to start applet." onmousedown="startApplet()" /&gt;
&lt;/div&gt;

&lt;span style="font-size:78%;"&gt;
Note: Windows users may need to right-click on the chart to enable the mouse wheel adjustments. For some reason, the popup menu that appears after a right-click causes the applet to start listening to mouse wheel events. This is most noticeable when dragging the applet out of the browser and then closing the dragged-out applet and returning to the browser window. This problem does not occur on Linux.&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
The code is pretty straightforward. I created a subclass of &lt;span class="code"&gt;MagnifierUI&lt;/span&gt; called &lt;span class="code"&gt;AdjustableMagnifierUI&lt;/span&gt;. In it I override the &lt;span class="code"&gt;processMouseWheelEvent&lt;/span&gt; method. If the Control and Shift keys are pressed on a mouse wheel event, the &lt;span class="code"&gt;setMagnifyingFactor&lt;/span&gt; method in &lt;span class="code"&gt;MagnifierUI&lt;/span&gt; is called. If no modifier keys are pressed, the &lt;span class="code"&gt;setRadius&lt;/span&gt; method is called.
&lt;br /&gt;
&lt;br /&gt;
The Windows hack is in the applet class. I override &lt;span class="code"&gt;setVisible&lt;/span&gt; as follows:
&lt;pre class="brush: java"&gt;
public void setVisible(boolean visible) {
  super.setVisible(visible);
  if (isShowing()) {
    // simulate right-mouse click to bring-up popup menu
    chartPanel.mousePressed(new MouseEvent(chartPanel,
        0, 0,
        java.awt.event.InputEvent.BUTTON3_DOWN_MASK,
        0, 0, 1, true));
    // immediately hide the popup menu
    chartPanel.getPopupMenu().setVisible(false);
  }
}
&lt;/pre&gt;If the applet is showing, I simulate a right-mouse click to bring-up JFreeChart's popup menu. Then the popup is immediately hidden. This enables the mouse wheel events to be handled correctly in Windows XP SP3. This hack only works when &lt;span class="code"&gt;setVisible&lt;/span&gt; is called. If the user has Java SE 6 Update 10 or later and he drags the applet out of the browser and then closes the dragged-out window, the applet returns to its original spot in the browser window WITHOUT calling &lt;span class="code"&gt;setVisible&lt;/span&gt;. In this case, mouse wheel events will not cause any magnifier adjustments UNTIL the user right-clicks and shows the popup menu. Dismissing the popup will restore the desired mouse wheel behavior. Does anyone know why this is or have a better solution? This hack is not needed on Ubuntu Linux 8.04.
&lt;br /&gt;
&lt;br /&gt;
I ran into one other problem when posting the applet. In order to avoid an &lt;span class="code"&gt;AccessControlException&lt;/span&gt;, I had to override the &lt;span class="code"&gt;isAWTEventListenerEnabled()&lt;/span&gt; method to return &lt;span class="code"&gt;false&lt;/span&gt; in &lt;span class="code"&gt;AdjustableMagnifierUI&lt;/span&gt;:
&lt;pre class="brush: java"&gt;
@Override
protected boolean isAWTEventListenerEnabled() {
  return false;
}
&lt;/pre&gt;I didn't notice any problems from overriding this method. Or perhaps this is the cause of the Windows misbehavior? I would appreciate any feedback on this.
&lt;br /&gt;
&lt;br /&gt;
To build the applet, you will need these:
&lt;ol&gt;&lt;li&gt;My Code: &lt;a href="http://patrickwebster.synthasite.com/resources/jfreechart-magnifier_src.tar.gz"&gt;tar.gz&lt;/a&gt; or &lt;a href="http://patrickwebster.synthasite.com/resources/jfreechart-magnifier_src.zip"&gt;zip&lt;/a&gt;&lt;/li&gt;&lt;li&gt;JXLayer &lt;a href="http://download.java.net/maven/2/org/swinglabs/jxlayer/3.0/jxlayer-3.0.jar"&gt;library&lt;/a&gt; (I use version 3.0)
&lt;/li&gt;&lt;li&gt;JFreeChart &lt;a href="http://sourceforge.net/projects/jfreechart/files/1.%20JFreeChart/1.0.12/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.12)
&lt;/li&gt;&lt;li&gt;JFree JCommon &lt;a href="http://sourceforge.net/projects/jfreechart/files/3.%20JCommon/1.0.15/" target="_new"&gt;library&lt;/a&gt; (I use version 1.0.15)
&lt;/li&gt;&lt;/ol&gt; The first code link above is a modified subset of Piet Blok's generic &lt;a style="font-family: courier new; font-weight: bold;" href="http://www.pbjar.org/blogs/jxlayer/PBZoom_src.zip"&gt;ZoomUI&lt;/a&gt; released on January 11th, 2009.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-4733008230168933953?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/4733008230168933953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2009/01/jfreechart-and-jxlayer-adjustable.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/4733008230168933953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/4733008230168933953'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2009/01/jfreechart-and-jxlayer-adjustable.html' title='JFreeChart and JXLayer Adjustable Magnifier'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7248575739629511717.post-7817988850020662685</id><published>2008-12-22T03:15:00.000-08:00</published><updated>2010-07-05T17:28:55.496-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Application'/><category scheme='http://www.blogger.com/atom/ns#' term='Demo'/><category scheme='http://www.blogger.com/atom/ns#' term='Mac'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='JFreeChart'/><category scheme='http://www.blogger.com/atom/ns#' term='JFrame'/><category scheme='http://www.blogger.com/atom/ns#' term='Dave'/><category scheme='http://www.blogger.com/atom/ns#' term='32-Bit'/><category scheme='http://www.blogger.com/atom/ns#' term='Fuller'/><category scheme='http://www.blogger.com/atom/ns#' term='Applet'/><category scheme='http://www.blogger.com/atom/ns#' term='SoyLatte'/><category scheme='http://www.blogger.com/atom/ns#' term='Magnifier'/><category scheme='http://www.blogger.com/atom/ns#' term='setContentPane'/><category scheme='http://www.blogger.com/atom/ns#' term='Landon'/><category scheme='http://www.blogger.com/atom/ns#' term='JXLayer'/><category scheme='http://www.blogger.com/atom/ns#' term='Gilbert'/><category scheme='http://www.blogger.com/atom/ns#' term='add'/><category scheme='http://www.blogger.com/atom/ns#' term='Intel'/><title type='text'>JXLayer with JFreeChart Demo Application (Not Applet)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SU96xiFNaWI/AAAAAAAAAAo/iKhk0fy0q-4/s1600-h/JXLayer-JFreeChart-Magnifier.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 222px;" src="http://1.bp.blogspot.com/_Lw-ycwOYOvU/SU96xiFNaWI/AAAAAAAAAAo/iKhk0fy0q-4/s400/JXLayer-JFreeChart-Magnifier.png" alt="" id="BLOGGER_PHOTO_ID_5282575879309715810" border="0" /&gt;&lt;/a&gt;
I wanted to run Dave Gilbert's &lt;a href="https://jxlayer.dev.java.net/" target="_new"&gt;JXLayer&lt;/a&gt; &lt;a href="http://www.jroller.com/dgilbert/entry/jfreechart_and_jxlayer" target="_new"&gt;demo applet&lt;/a&gt; that uses &lt;a href="http://www.jfree.org/jfreechart/" target="_new"&gt;JFreeChart&lt;/a&gt;. But my 32-bit Intel Mac won't run applets in Java 1.6. I do have Landon Fuller's &lt;a href="http://landonf.bikemonkey.org/static/soylatte/" target="_new"&gt;SoyLatte&lt;/a&gt; implementation of Java 1.6 installed. So I converted the applet into an application and can run it from Eclipse. To run the demo in an application, first download the original &lt;a href="http://www.jfree.org/jfreechart/jfreechart-jxlayer-appletdemo.zip"&gt;zip file&lt;/a&gt; from &lt;a href="http://www.jroller.com/dgilbert/entry/jfreechart_and_jxlayer" target="_new"&gt;Dave Gilbert's blog&lt;/a&gt;. (You may also need to download and rename the &lt;a style="font-family: courier new;" href="http://download.java.net/maven/2/org/swinglabs/jxlayer/3.0/jxlayer-3.0.jar"&gt;jxlayer.jar&lt;/a&gt; file if it is not in the zip file's lib directory.) You will replace the file &lt;span style="font-family:courier new;"&gt;JXLayerAppletDemo1.java&lt;/span&gt; with the file &lt;span style="font-family:courier new;"&gt;JXLayerApplicationDemo.java&lt;/span&gt; below. Create a new Java project in Eclipse with the updated source file. In the project properties, add these 3 libraries to the external jars:&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;jcommon-1.0.14.jar&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;jfreechart-1.0.11.jar&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;jxlayer.jar&lt;/span&gt;&lt;br /&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;font-size:130%;font-family:courier new;"&gt;JXLayerApplicationDemo.java:&lt;/span&gt;
&lt;pre class="brush: java"&gt;
/* -----------------------
 * JXLayerAppletDemo1.java
 * -----------------------
 * (C) Copyright 2008, by Object Refinery Limited.
 */

package demo.jxlayer;

import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.geom.Ellipse2D;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

//import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jdesktop.jxlayer.JXLayer;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.annotations.XYDrawableAnnotation;
import org.jfree.chart.axis.DateAxis;
import org.jfree.chart.axis.DateTickUnit;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.TickUnitSource;
import org.jfree.chart.axis.TickUnits;
import org.jfree.chart.labels.StandardXYToolTipGenerator;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.data.time.Year;
import org.jfree.data.xy.XYDataset;
import org.jfree.ui.RectangleInsets;

/**
 * An applet that shows a chart with a magnifying glass.
 */
//public class JXLayerAppletDemo1 extends JApplet {
public class JXLayerApplicationDemo extends JPanel {

  /**
   * Instantiate main frame and set visible
   */
  public static void main (String args[]) {
    final JXLayerApplicationDemo app = new JXLayerApplicationDemo();
    JFrame f = new JFrame("JFreeChart Magnifying Glass");
    f.addWindowListener (
        new WindowAdapter() {
          @Override
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        }
    );

    f.add(app, BorderLayout.CENTER);
    f.pack();
    f.setVisible(true);
  }


  /**
   * Constructs the demo application.
   */
  public JXLayerApplicationDemo() {
    super();
    XYDataset dataset = createDataset();
    JFreeChart chart = createChart(dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    JXLayer layer = new JXLayer(chartPanel);
    MagnifierUI ui1 = new MagnifierUI();
    layer.setUI(ui1);
    chartPanel.setPreferredSize(new java.awt.Dimension(750, 390));
    chartPanel.setPopupMenu(null);
    //setContentPane(layer);
    add(layer);
  }

  /**
   * Creates a sample chart.
   *
   * @param dataset  a dataset for the chart.
   *
   * @return A sample chart.
   */
  private static JFreeChart createChart(XYDataset dataset) {
    JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "JFreeChart and JXLayer",
        null, "$ million", dataset,
        true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    DateAxis xAxis = (DateAxis) plot.getDomainAxis();
    xAxis.setLowerMargin(0.2);
    xAxis.setUpperMargin(0.2);
    xAxis.setStandardTickUnits(createStandardDateTickUnits());

    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setLowerMargin(0.2);
    yAxis.setUpperMargin(0.2);

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseLinesVisible(true);
    renderer.setSeriesShape(0, new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    renderer.setSeriesShape(1, new Ellipse2D.Double(-5.0, -5.0, 10.0, 10.0));
    renderer.setSeriesStroke(0, new BasicStroke(3.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f, BasicStroke.CAP_ROUND,
        BasicStroke.JOIN_ROUND, 5.0f, new float[] {5.0f, 4.0f}, 0.0f));
    renderer.setSeriesFillPaint(0, Color.white);
    renderer.setSeriesFillPaint(1, Color.white);
    renderer.setUseFillPaint(true);

    renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    renderer.setDefaultEntityRadius(6);

    renderer.addAnnotation(new XYDrawableAnnotation(
        new Month(4, 2005).getFirstMillisecond(), 600, 180, 100, 3.0,
        createPieChart()));
    renderer.addAnnotation(new XYDrawableAnnotation(
        new Month(9, 2007).getFirstMillisecond(), 1250, 120, 100, 2.0,
        createBarChart()));
    renderer.setBaseToolTipGenerator(
        new StandardXYToolTipGenerator("{0} = ({1}, {2})",
            new SimpleDateFormat("yyyy"),
            new DecimalFormat("$#,##0.00")));

    plot.setRenderer(renderer);
    return chart;
  }

  /**
   * Creates a sample dataset.
   *
   * @return A dataset.
   */
  private static XYDataset createDataset() {
    TimeSeries series1 = new TimeSeries("Division A", Year.class);
    series1.add(new Year(2005), 1520);
    series1.add(new Year(2006), 1132);
    series1.add(new Year(2007), 450);
    series1.add(new Year(2008), 620);
    TimeSeries series2 = new TimeSeries("Division B", Year.class);
    series2.add(new Year(2005), 1200);
    series2.add(new Year(2006), 1300);
    series2.add(new Year(2007), 640);
    series2.add(new Year(2008), 520);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);
    return dataset;
  }

  private static JFreeChart createPieChart() {
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue("Engineering", 43.2);
    dataset.setValue("Research", 13.2);
    dataset.setValue("Advertising", 20.9);
    PiePlot plot = new PiePlot(dataset);
    plot.setBackgroundPaint(null);
    plot.setOutlinePaint(null);
    plot.setBaseSectionOutlinePaint(Color.white);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));
    plot.setLabelFont(new Font("Dialog", Font.PLAIN, 18));
    plot.setMaximumLabelWidth(0.25);
    JFreeChart chart = new JFreeChart(plot);
    chart.setBackgroundPaint(null);
    chart.removeLegend();
    chart.setPadding(RectangleInsets.ZERO_INSETS);
    return chart;
  }

  private static JFreeChart createBarChart() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(10.0, "R1", "Q1");
    dataset.addValue(7.0, "R1", "Q2");
    dataset.addValue(8.0, "R1", "Q3");
    dataset.addValue(4.0, "R1", "Q4");
    dataset.addValue(10.6, "R2", "Q1");
    dataset.addValue(6.1, "R2", "Q2");
    dataset.addValue(8.5, "R2", "Q3");
    dataset.addValue(4.3, "R2", "Q4");
    JFreeChart chart = ChartFactory.createBarChart("Sales 2008", null,
        null, dataset, PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(null);
    chart.getPlot().setBackgroundPaint(new Color(200, 200, 255, 60));
    return chart;
  }

  private static TickUnitSource createStandardDateTickUnits() {
    TickUnits units = new TickUnits();
    DateFormat df = new SimpleDateFormat("yyyy");
    units.add(new DateTickUnit(DateTickUnit.YEAR, 1,
        DateTickUnit.YEAR, 1, df));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 2,
        DateTickUnit.YEAR, 1, df));
    units.add(new DateTickUnit(DateTickUnit.YEAR, 5,
        DateTickUnit.YEAR, 5, df));
    return units;
  }

}


&lt;/pre&gt;Alternatively, the java files can be compiled on the command line.

First, navigate to the &lt;span style="font-family:courier new;"&gt;source&lt;/span&gt; directory within the expanded zip archive and type:
&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;javac -classpath .:../lib/jfreechart-1.0.11.jar:../lib/jxlayer.jar:../lib/jcommon-1.0.14.jar demo/jxlayer/*.java&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
Run the application from the &lt;span style="font-family:courier new;"&gt;source&lt;/span&gt; directory with this command:&lt;br /&gt;
&lt;span style="font-family:courier new;"&gt;java -classpath .:../lib/jfreechart-1.0.11.jar:../lib/jxlayer.jar:../lib/jcommon-1.0.14.jar demo.jxlayer.JXLayerApplicationDemo&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;
The code above gives an example of how to convert an applet to an application. These three steps are necessary:
&lt;ul&gt;&lt;li&gt;Extend &lt;span style="font-family:courier new;"&gt;JPanel&lt;/span&gt; instead of &lt;span style="font-family:courier new;"&gt;JApplet&lt;/span&gt;.
&lt;/li&gt;&lt;li&gt;Provide a &lt;span style="font-family:courier new;"&gt;main&lt;/span&gt; method to instantiate the application and place it in a visible &lt;span style="font-family:courier new;"&gt;JFrame&lt;/span&gt;.
&lt;/li&gt;&lt;li&gt;Call &lt;span style="font-family:courier new;"&gt;add&lt;/span&gt; instead of &lt;span style="font-family:courier new;"&gt;setContentPane&lt;/span&gt; in the constructor.&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7248575739629511717-7817988850020662685?l=patrickwebster.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://patrickwebster.blogspot.com/feeds/7817988850020662685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://patrickwebster.blogspot.com/2008/12/jxlayer-with-jfreechart-application-not.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7817988850020662685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7248575739629511717/posts/default/7817988850020662685'/><link rel='alternate' type='text/html' href='http://patrickwebster.blogspot.com/2008/12/jxlayer-with-jfreechart-application-not.html' title='JXLayer with JFreeChart Demo Application (Not Applet)'/><author><name>Patrick Webster</name><uri>http://www.blogger.com/profile/02878847524711954186</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='http://2.bp.blogspot.com/_Lw-ycwOYOvU/TTFi-AvqFuI/AAAAAAAAAC8/HOS_cZpC6Rc/S220/0049c.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Lw-ycwOYOvU/SU96xiFNaWI/AAAAAAAAAAo/iKhk0fy0q-4/s72-c/JXLayer-JFreeChart-Magnifier.png' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
