⚡ Ultra-high performance Win32 native window engine specifically designed as the core windowing foundation for FastVulkan, FastGraphics, DirectX and hardware-accelerated composition pipelines.
FastWindow provides zero-overhead, kernel-direct Win32 native window creation (FastWindow.create(...)), bypassing Java AWT/Swing entirely. It guarantees flicker-free resizing, seamless Dark Mode and DWM styling, dynamic Unicode titling, and clean HWND lifecycle management.
Watch the Demo | Watch JMH Benchmark (YouTube)
import fastwindow.FastNativeWindow;
import fastwindow.FastWindow;
import fasttheme.FastTheme;
public class NativeExample {
public static void main(String[] args) {
try (FastNativeWindow window = FastWindow.create("FastWindow — Native Engine for FastVulkan", 1024, 600)) {
long hwnd = window.getHWND();
// Dark Mode & Black Titlebar via FastTheme
FastTheme.setTitleBarDarkMode(hwnd, true);
FastTheme.setTitleBarColor(hwnd, 20, 20, 20);
FastTheme.setTitleBarTextColor(hwnd, 240, 240, 240);
FastTheme.setCornerStyle(hwnd, 2); // Windows 11 Rounded Corners
// Show window seamlessly once styled
window.setVisible(true);
while (window.pollEvents()) {
// Pass hwnd to FastVulkan / GPU presentation loop...
}
}
}
}- Quick Start
- Why FastWindow?
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- Related Projects
- License
Standard Java windows (JFrame, Frame) on Windows suffer from significant native limitations when used with modern GPU rendering pipelines:
- ❌ Swing/AWT Event Loop Overhead — AWT uses asynchronous, multi-threaded event dispatching that induces boundary jitter and frame drops during live resize.
- ❌ Flicker & Erase Issues — Default Win32 background erases cause white/black flashing before GPU frames present.
- ❌ Lack of Modern DWM Harmony — Java frames cannot natively toggle Windows 11 rounded corners, immersive Dark Mode, or title bar colors without custom JNI hooks.
FastWindow eliminates the entire Java AWT layer and creates pure, kernel-direct Win32 windows with direct HWND access for FastVulkan and FastGraphics:
| Feature | Java Swing (JFrame) |
JavaFX (Stage) |
FastWindow |
|---|---|---|---|
| Window Subsystem | Heavy AWT Peer wrapper | Prism / Glass toolkit | Direct Win32 CreateWindowExW |
| GPU Surface Integration | AWT Canvas JAWT bridge | JNI offscreen texture | Raw 64-bit HWND for FastVulkan |
| Message Pump Latency | AWT EventQueue dispatch | JavaFX Pulse loop | ~12 ns (pollEvents Win32 pump) |
| Resize Flicker | Severe (WM_ERASEBKGND) |
Occasional frame stutter | Zero-Flicker Hardware Sync |
| Windows 11 DWM Styling | OS default light titlebar | Custom undecorated hacks | Native DWM Dark Mode & Corners |
| Dependencies | JDK Desktop module | Modular JavaFX runtime | Pure Java 17+ backed by FastCore |
- 🪟 Pure Standalone Win32 Windows — Zero-overhead native windows with direct UTF-16 Unicode titlebars, fullscreen, centering, and icon support.
- 🌋 First-Class Vulkan & DirectX Support — Clean HWND handle lifecycle designed for surface creation and zero-jitter live resizing.
- ⚡ Zero-Jitter Live Resize — Hardware-synced message pump with immediate bounds dispatching.
- 📏 Kernel-Level Constraints — Enforces hard Min/Max window sizes directly in the Windows kernel via
WM_GETMINMAXINFO. - 🎨 DWM & FastTheme Harmony — Native Dark Mode, title bar coloring, and rounded corners for Windows 11.
- 🔑 Universal HWND Access — Provides a clean 64-bit native HWND handle for Vulkan, DirectX, and DWM composition engines.
- 🌋 High-FPS Vulkan Rendering — Dedicated native window surface lifecycle for
vkCreateWin32SurfaceKHRwithout AWT peer synchronization lags. - 🎮 Game Engines & Real-Time Simulators — Microsecond message pump with
pollEvents()delivering zero-allocation game loops exceeding 1,000+ FPS. - 🖥️ Borderless Fullscreen Presenters — Instant transition to exclusive borderless fullscreen for presentations and hardware-accelerated viewport overlays.
- 🎨 Immersive Windows 11 Desktop Apps — Native dark titlebars, custom background tinting, and rounded corners harmonized with
FastTheme.
FastWindow is rigorously profiled using JMH (Java Microbenchmark Harness) to guarantee zero-overhead event polling and native Win32 dispatching.
| Operation / Benchmark | Throughput (ops/ms) | Ops per Second | Latency / Overhead |
|---|---|---|---|
Message Pump (pollEvents) |
~80,159 ops/ms | > 80.1 Million | ~12 ns |
Kernel Constraints (setConstraints) |
~57,144 ops/ms | > 57.1 Million | ~17 ns |
Dynamic Unicode Titling (setTitle) |
~211 ops/ms | > 211,000 | ~4.7 µs (DWM Sync) |
Bounds Dispatch (setBounds) |
~118 ops/ms | > 118,000 | ~8.4 µs (Win32 API) |
Measured on Windows 11, Intel Core i5-1135G7 (Surface Pro 8), JDK 21.0.12.
| Method | Return Type | Description | Docs |
|---|---|---|---|
FastWindow.create(title, w, h) |
FastNativeWindow |
Creates a standalone native Win32 window context. | Reference |
getHWND() |
long |
Returns the raw 64-bit native window handle (HWND). | Reference |
pollEvents() |
boolean |
Pumps native Win32 message loop (PeekMessageW). |
Reference |
setTitle(String title) |
void |
Updates native window title with UTF-16 Unicode text. | Reference |
setVisible(boolean visible) |
void |
Shows (SW_SHOW) or hides the native window. |
Reference |
setBounds(x, y, w, h) |
void |
Updates window position and size simultaneously. | Reference |
setMinimumSize(minW, minH) |
void |
Sets kernel-level min tracking size via WM_GETMINMAXINFO. |
Reference |
setMaximumSize(maxW, maxH) |
void |
Sets kernel-level max tracking size via WM_GETMINMAXINFO. |
Reference |
setFullscreen(boolean fs) |
void |
Toggles borderless exclusive fullscreen mode. | Reference |
setIconImage(BufferedImage img) |
void |
Sets the native 32-bit ARGB title bar and taskbar icon. | Reference |
close() |
void |
Destroys the window handle and frees unmanaged resources. | Reference |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Native Black Window & Theme Demo | Demo.java | run-demo.bat |
Standalone native Win32 window with Dark Mode, black titlebar, dynamic FPS title, and round icon. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
High-frequency message pump and native call throughput benchmarking. |
Add the JitPack repository and the dependencies to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- FastWindow Library -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastWindow</artifactId>
<version>0.1.2</version>
</dependency>
<!-- FastCore (Required Native Loader) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastCore</artifactId>
<version>0.1.0</version>
</dependency>
<!-- FastTheme (Optional Styling) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastTheme</artifactId>
<version>0.1.4</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastWindow:0.1.2'
implementation 'com.github.andrestubbe:FastCore:0.1.0'
implementation 'com.github.andrestubbe:FastTheme:0.1.4'
}Download the latest JARs directly to add them to your classpath:
- 📦 fastwindow-0.1.2.jar (The Core Library)
- 📦 fastcore-0.1.0.jar (Required Native JNI loader)
- 📦 fasttheme-0.1.4.jar (Recommended for Dark Mode & Styling)
- COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
- REFERENCE.md: Full API descriptions and method reference.
- PHILOSOPHY.md: The engineering rationale for zero-allocation performance.
- ROADMAP.md: Future milestones and planned features.
| Platform | Architecture | Status | Driver / Subsystem |
|---|---|---|---|
| Windows 10 / 11 | x64 | ✅ Fully Supported | Native Win32 Subclassing & DirectComposition |
| Linux | x64 / AArch64 | 🚧 Planned | X11 (Xlib/xcb) & Wayland xdg-shell |
| macOS | Apple Silicon / x64 | 🚧 Planned | Cocoa NSWindow & Metal Layer Hosting |
FastCore— Native Library Loader for JavaFastTheme— Advanced UI Styling Engine (DWM/Mica/Acrylic)FastGUI— High-Performance Retained-Mode UI Framework
MIT License — See LICENSE file for details.
Part of the FastJava Ecosystem — Making the JVM faster. 🚀
