Webswing 25.10
Webswing is a web server technology that allows Java desktop applications (Swing, JavaFX, SWT) to run in a web browser without any modifications to the original source code. It renders the desktop app on the server and streams the interface to the browser using HTML5 canvas, handling all user interactions transparently.
What Webswing solves
Many organizations have substantial investments in Java desktop applications that contain critical business logic developed over years or decades. These applications often can't be easily rewritten due to:
- Complex domain logic that would be risky to recreate
- Integration with desktop-specific libraries or hardware
- Time and cost constraints of a full rewrite
- Need to maintain feature parity with existing functionality
Webswing allows these applications to be web-accessible without modification, preserving their original functionality and appearance.
Integration with webforJ
The webforJ Webswing integration provides the WebswingConnector component, which allows you to embed Webswing-hosted applications directly within your webforJ app. This creates opportunities for:
Progressive modernization
Instead of an all-or-nothing rewrite, you can:
- Start by embedding your existing Swing app via
WebswingConnector - Build new features in webforJ around the embedded app
- Gradually replace Swing components with webforJ equivalents
- Eventually phase out the legacy app entirely
Hybrid applications
Combine modern web UI built with webforJ with specialized desktop functionality:
- Use webforJ for user-facing interfaces, dashboards, and reports
- Leverage Swing for complex visualizations or specialized editors
- Maintain a single integrated app experience
How it works
The integration operates through three layers:
- Webswing Server: runs your Java desktop app, capturing its visual output and processing user input
- WebswingConnector Component: a webforJ component that embeds the Webswing client, managing the connection and communication with the server
- Communication Protocol: bidirectional messaging that allows your webforJ app to send commands to the Swing app and receive events back
When a user accesses your webforJ app, the WebswingConnector establishes a connection to the Webswing server. The server creates or reconnects to an app instance, and begins streaming the visual state to the browser. User interactions (mouse, keyboard) are captured and sent to the server, where they're replayed on the actual Swing app.
Topics
📄️ Setup and Configuration
Install the Webswing server, register a Swing app in the admin console, and configure CORS so webforJ can embed it with WebswingConnector.
📄️ Communication
Exchange actions and events between a webforJ app and an embedded Swing app through WebswingConnector lifecycle and custom action handlers.
📄️ Modernization Tutorial
Modernize a Swing customer management app step by step by embedding it with WebswingConnector and layering in webforJ dialogs and forms.