The article explores how to create a cross-platform Java desktop application using a modern web-based UI built with:
React
Tailwind CSS
TypeScript
shadcn/ui (a component library)
Instead of using outdated Java UI toolkits like Swing or JavaFX, the app embeds a Chromium-based web view via JxBrowser, allowing developers to leverage the flexibility and polish of web technologies.
Built using JFrame (Swing)
Embeds a browser view powered by JxBrowser
Development mode: Loads from localhost with hot reload
Production mode: Loads from internal resources using a custom jxb:// protocol via JxBrowser’s UrlRequestInterceptor
This avoids the need for external servers and protects the app’s source code from inspection.
Java methods exposed via @JsAccessible
JavaScript calls Java methods directly
Defines a type-safe API using .proto files
Generates Java and TypeScript code
Uses gRPC for structured communication between frontend and backend
This approach is more scalable and maintainable for larger apps.
Using web UIs in desktop apps simplifies development, improves UI quality, and taps into a rich ecosystem of tools. The article provides a practical guide to embedding React-based UIs in Java apps while maintaining secure, offline-ready architecture
0
1
0