Skip to content
CMO & CTO
CMO & CTO

Closing the Bridge Between Marketing and Technology, By Luis Fernandez

  • Digital Experience
    • Experience Strategy
    • Experience-Driven Commerce
    • Multi-Channel Experience
    • Personalization & Targeting
    • SEO & Performance
    • User Journey & Behavior
  • Marketing Technologies
    • Analytics & Measurement
    • Content Management Systems
    • Customer Data Platforms
    • Digital Asset Management
    • Marketing Automation
    • MarTech Stack & Strategy
    • Technology Buying & ROI
  • Software Engineering
    • Software Engineering
    • Software Architecture
    • General Software
    • Development Practices
    • Productivity & Workflow
    • Code
    • Engineering Management
    • Business of Software
    • Code
    • Digital Transformation
    • Systems Thinking
    • Technical Implementation
  • About
CMO & CTO

Closing the Bridge Between Marketing and Technology, By Luis Fernandez

JavaFX for Desktop Apps: Beyond Swing

Posted on August 9, 2010 By Luis Fernandez

Swing still runs a lot of serious desktop software, and it is not going away tomorrow.
But after a week living in JavaFX 1.3 land, I am convinced these scenes and bindings deserve a seat on our desktops.

Why JavaFX for desktop apps right now

Oracle now owns Sun and the Java story is getting rearranged, but JavaFX quietly shipped some real gains. The scene graph model feels natural for UI work where you animate, fade, and move nodes instead of hand wiring paint calls. Binding cuts a ton of glue code that we usually drop into Swing models and listeners. Timeline animations are a joy for micro interactions like button pulses or progress whispers. CSS styling is not full web CSS, yet it is already better than fiddling with UIManager keys. With NetBeans 6.9 the preview is good enough to trust while you sketch, and the runtime in 1.3 is snappier than the first cut. If you build desktop apps that need polish, this toolbox is worth opening.

Data binding and animation in JavaFX Script feel like the missing link between model and pixels. This tiny sample drives itself without listeners all over the place:

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.animation.Timeline;
import javafx.animation.KeyFrame;

var counter = 0;

Stage {
    title: "FX Beyond Swing"
    scene: Scene {
        width: 320
        height: 120
        content: [
            Text {
                x: 20, y: 60
                fill: Color.DODGERBLUE
                font: Font { size: 24 }
                content: bind "Clicks: {counter}"
            }
        ]
    }
}

Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
        KeyFrame {
            time: 1s
            action: function() { counter++; }
        }
    ]
}.play();

Going beyond Swing without throwing it away

Many teams cannot rewrite a mature Swing app, and that is fine. The bridge goes both ways. You can place Swing inside JavaFX using javafx.ext.swing.SwingComponent, or embed JavaFX in Swing with JFXPanel for measured upgrades. This lets you replace one gnarly panel with a smooth chart or a skinnable control without touching the rest. Be mindful of the event threads since you now have the Swing EDT and the JavaFX thread living together. Keep heavy painting off the path and batch state changes to avoid jitter. Start small and ship something the team can feel on day one.

Wrapping a Swing button inside JavaFX is a one liner, which is perfect for gradual migrations:

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.ext.swing.SwingComponent;

import javax.swing.JButton;

var jb = new JButton("Swing says hi");

Stage {
    title: "Swing inside FX"
    scene: Scene {
        width: 300, height: 120
        content: [ SwingComponent.wrap(jb) ]
    }
}

Tooling, deployment, and the tradeoffs

The control set in core JavaFX is still thin, but projects like JFXtras are filling gaps fast. Styling through JavaFX CSS is simpler than UI defaults and it keeps designers and developers speaking the same language. Packaging with Web Start or the browser plugin is straightforward, and for desktop users that means click to run with caching. Watch your JAR count and image sizes since first start time sells or sinks trust. Compared with Flash or Silverlight, you trade instant plugin ubiquity for a strong Java stack and plain Java interop. For rich desktop apps that want animation, data binding, and a cleaner UI story than raw Swing, JavaFX already pays its rent.

If Swing is the toolbox, JavaFX is the sketchbook where desktop apps finally feel designed.

General Software Software Engineering

Post navigation

Previous post
Next post
  • Digital Experience (94)
    • Experience Strategy (19)
    • Experience-Driven Commerce (5)
    • Multi-Channel Experience (9)
    • Personalization & Targeting (21)
    • SEO & Performance (10)
  • Marketing Technologies (92)
    • Analytics & Measurement (14)
    • Content Management Systems (45)
    • Customer Data Platforms (4)
    • Digital Asset Management (8)
    • Marketing Automation (6)
    • MarTech Stack & Strategy (10)
    • Technology Buying & ROI (3)
  • Software Engineering (310)
    • Business of Software (20)
    • Code (30)
    • Development Practices (52)
    • Digital Transformation (21)
    • Engineering Management (25)
    • General Software (82)
    • Productivity & Workflow (30)
    • Software Architecture (85)
    • Technical Implementation (23)
  • 2025 (12)
  • 2024 (8)
  • 2023 (18)
  • 2022 (13)
  • 2021 (3)
  • 2020 (8)
  • 2019 (8)
  • 2018 (23)
  • 2017 (17)
  • 2016 (40)
  • 2015 (37)
  • 2014 (25)
  • 2013 (28)
  • 2012 (24)
  • 2011 (30)
  • 2010 (42)
  • 2009 (25)
  • 2008 (13)
  • 2007 (33)
  • 2006 (26)

Ab Testing Adobe Adobe Analytics Adobe Target AEM agile-methodologies Analytics architecture-patterns CDP CMS coding-practices content-marketing Content Supply Chain Conversion Optimization Core Web Vitals customer-education Customer Data Platform Customer Experience Customer Journey DAM Data Layer Data Unification documentation DXP Individualization java Martech metrics mobile-development Mobile First Multichannel Omnichannel Personalization product-strategy project-management Responsive Design Search Engine Optimization Segmentation seo spring Targeting Tracking user-experience User Journey web-development

©2025 CMO & CTO | WordPress Theme by SuperbThemes