Window size vs Scene size
The javafx.scene.Scene class is responsible for rendering JavaFX 2.0 content. A scene can be placed into various containers, for example, javafx.stage.Stage or javafx.embed.swing.JFXPanel. The size of a container may be or may not be equal to the size of the scene attached to it. In some cases you might want to specify the content size, e.g. when showing a confirmation...
on Jun 23, 2011
JavaFX 2.0 Beta is out on May 26, 2011. There are many blogs posted about it already, http://fxexperience.com/ is the primary one, and I don't want to post yet another overview of what features are available. Instead, I would like to take a deeper tour into one particular component called JFXPanel
What is JFXPanel?
JavaFX 1.x provided a way to insert existing Swing components into FX scenes. It...
on Jun 2, 2011
Sometimes I wonder why rather good technology suddenly dies. Does anybody remember InfoBus? JavaBeans? Swing? Java?
All of those had been brilliant technologies, enabling programmers doing things really easily. But at one day, news about those technologies just stopped. People tend to say that those technologies "died". Well, what does that mean, and is that true?
Let's start with...
on Apr 24, 2011
In one of our desktop applications we're emphasizing full-screen mode more than ever before. Among other things, this means we need to display some modal dialogs in full-screen mode. On Windows this appears to work fine, but on Mac the dialog appears to be buried. Here is a test application demonstrating the problem:
import java.awt.DisplayMode;import java.awt.GraphicsDevice;import...
on Apr 5, 2011
The first rule of Swing programming is to always interact with Swing components in the Event Dispatch Thread (EDT, for short). Swing is single-threaded (as a lot of UI toolkits are) and as such it can only makes guarantees about the state of Swing components when interacted with properly on the EDT. Some Swing methods are thread-safe, such as JComponent.repaint. Recently, I...
on Jan 19, 2011
I am pleased to announce the release of Apache Pivot 2.0. Apache Pivot is an open-source platform for building installable Internet applications (IIAs) in Java. This major update includes a number of significant enhancements including:
Support for dynamic data binding
Pivot 1.5 and earlier supported data binding via a load/store model that maps well to client/server applications such as REST...
on Jan 19, 2011
Ruby Red, the first full release of Leonardo Sketch is ready for download. Leonardo is a desktop open source drawing program written entirely in Java. In this first version of Leonardo, features include:
Full vector drawing with shapes, paths, groups, and images.
Export to PNG, PDF, SVG, and HTML Canvas.
Sharing via Email and Twitter
Integrated Flickr image search
Installer builds for windows...
on Nov 22, 2010
Last week, I updated my local copy of the SwingX source code, modifying SwingXUtilities to inlcude an invokeLater and an invokeAndWait that support return values. I plan on checking in that code sometime today. In one of those strange coincidences, Swing links of the week pointed me to Jan Kotek's post: SwingUtilities.invokeAndWait with return value. It's a good article,...
on Nov 15, 2010
JavaFX 2.0 is not multiplatform! It can't do subpixel antialiasing!! … these were among the reactions to the first beta releases, that I'm not sure to understand as trolling or simple laziness. These mysteries are usually solved with a simple look at JavaFX's public JIRA issue tracking system. The current implementation is still a beta, not even a feature-complete beta, so there are many...
on Jun 18, 2011
It's been a long time, well long in Internet-years, since my last blog on JavaFX. Now I'm approaching JavaFX 2.0 by porting the JavaFX 1.x programs that I had written and blogged about here. These new ports will allow me to evaluate the evolution of the platform. Has the wait been worth it?
Porting from JavaFX 1
For my first port I’ve picked JavaFX Balls. (But this blog is not about...
on May 28, 2011
It's been several years since the book Filthy Rich Clients by Chet Haase and Romain Guy was published back in 2008. After reading the book I became a big fan of the Timing Framework that Chet posted at the timingframework project at java.net. Chet had elegantly solved a tricky problem—controlling the timing of animations. But, woe is me, I developed Eclipse plug-ins and Chet's code was...
on Apr 13, 2011
After more than a decade in the Java universe, today I had just enough of remembering where my executable JARs are located and typing all the lengthy path names, so I finally taught Windows to deal with Java archives just the same way as it deals with it's native executables EXE and CMD. The trick is so simple that I actually do not understand why the JRE installer isn't applying it automatically...
on Dec 29, 2010
In the list of the things that needs improving in Swing, the implementation of listeners takes the first place. The problem is the fact that the order in which listeners are notified is not specified and it is not even guaranteed that your listeners will be notified after the Swing system listeners. Actually all listeners can be mixed together with any possible combination and it leads to two...
on Jun 15, 2011
Generics doesn't work well with arrays. Everybody knows that you can't create a generified array,
but not many people really know what it was done this way.
A nice article from Brian Goetz helped me to understand the problem
when I studied the new features of JDK 5.
The arrays in java are covariant when generics are not. The following code clearly shows it:
String stringArray = new String[1...
on May 5, 2011
Checked exceptions are painful. I could write a long article about it,
but there are more than enough good blogs describing this problem. My favorite article is written by Rod Waldhoff.
From my point of view the existence of the InvocationTargetException clearly shows the problem.
Imagine you call a method which throws an exception, you properly catches it
and then you decide to rewrite the...
on Mar 21, 2011
We have all read the "Effective Java" book and know that we should prefer interfaces over abstract classes.
This is a known and respected pattern which should be used wherever possible.
However the years in the JDK team tauhgt me not to blindly trust
to good practices from the world of application programming.
A distinctive feature of the JDK is backward compatibility.
on Mar 11, 2011
I truly love the Swing GUI toolkit, I enjoy its flexibility, opennes and great abilities.
I know that some people say that Swing is too difficult to learn,
and I partly accept it because it took me several years working in the Swing team
to get the whole picture of the AWT, Java 2D and the Swing itself.
The Swing history counts more then 10 years and it is definitely not about end.
on Mar 10, 2011
Often code has a bad smell, then it gets time to replace custom lines by common patterns. Sometimes it even makes sense to even replace a single line of code by a class just wrapping that single line (which actually increases code size), if that makes readers better understand what the code does. Unfortunately often such patterns are publicly known but do not exist as ready to...
on Jan 1, 2011
We are making progress on the next release of Leonardo, an open source desktop Java drawing program. One of the key features scheduled for the next release is a webservice that lets users save and share reusable symbols they've created. For example, someone could create a set of GWT mockup widgets, then share this set with others.
The challenge I face is that I'm mainly a client side developer....
on Dec 7, 2010
Google maps was a useful hit from the moment it went on line. Since then thousands of web pages have added map capability to their sites, courtesy of Google. Let me illustrate how you can add Google maps to your Java application.
Google furnishes its maps via a simple REST request. Does this mean you need to add some fancy REST framework to your application? Not at all! Java provides...
on Oct 16, 2010