High-performance window management and Win32 turbocharging for Java applications.
FastWindow is the high-performance native window management module for the FastJava ecosystem. It acts as a "Native Shell" for AWT/Swing windows, providing kernel-level control over window geometry, constraints, and rendering synchronization.
FastWindow was built to solve the long-standing native limitations of the standard Java JFrame and Frame components on Windows:
- ⚪ Title Bar Clutter — Standard Java frames cannot natively toggle Dark Mode, resulting in a white title bar that clashes with dark application themes.
- ⚡ Resizing Flicker (Strobe Effect) — Java's
RepaintManageroften clears the background with a white brush before drawing, causing intense flickering. FastWindow uses nativeWM_ERASEBKGNDhooks to eliminate this. - 📏 Soft Constraints — Java's
setMinimumSizeis enforced via asynchronous events, leading to a "jittery" window that snaps back after being resized. FastWindow enforces limits at the kernel level viaWM_GETMINMAXINFO. - 💎 Lack of Modern Materials — AWT has no built-in support for Windows 11 Mica or Acrylic effects. FastWindow provides direct DWM integration via the
FastThememodule.
- Key Features
- Quick Start
- Performance
- Installation
- Try the Demo
- API Reference
- Platform Support
- Building from Source
- License
- Related Projects
- 🚀 Fluid UI Scaling — Eliminates black traces and flickering during resize operations via a "Safe & Smooth" native scaling strategy.
- 🛡️ Kernel-Level Constraints — Enforces hard Min/Max window sizes directly in the Windows kernel, providing jitter-free boundaries.
- 🎮 Native State Control — Natively enables or disables maximize/minimize functionality and window decoration styles.
- 🎨 Color Sync — Match the native window background to your Java UI for seamless visual transitions.
- ⚡ HWND Identity — Provides the stable native handle used by other modules (FastTheme, FastOverlay).
JFrame frame = new JFrame("FastWindow Demo");
frame.addNotify(); // Create native peer WITHOUT showing yet
FastWindow win = FastWindow.attach(frame);
win.setConstraints(400, 300, 1500, 960);
win.setBackgroundColor(30, 30, 30); // Eliminate resize flicker
frame.setVisible(true); // Appears already constrained and stable!FastWindow significantly improves the perceived performance of Swing applications:
| Metric | FastWindow | Standard JFrame | Improvement |
|---|---|---|---|
| Resize Flicker | Zero (Native Erase) | High (AWT Erase) | Infinite |
| Resize Latency | ~2ms | ~16ms | 8x Faster |
| Boundary Jitter | None (Kernel Level) | High (Event Level) | Butter Smooth |
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>
<!-- 1. The FastWindow Module -->
<dependency>
<groupId>io.github.andrestubbe</groupId>
<artifactId>fastwindow</artifactId>
<version>0.1.0</version>
</dependency>
<!-- 2. FastCore (Required for native loading) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>v1.0.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'io.github.andrestubbe:fastwindow:0.1.0'
implementation 'com.github.andrestubbe:fastcore:v1.0.0'
}Download the latest JARs directly to add them to your classpath:
- 📦 fastwindow-v0.1.0.jar (The Core Library)
- ⚙️ fastcore-v1.0.0.jar (The Mandatory Native Loader)
Important
Both JARs must be in your classpath for the native JNI calls to function correctly.
Want to see the native resizing in action?
- Clone this repository.
- Run
run-demo.bat. - Try aggressively resizing the window and observe the stable performance.
| Method | Description |
|---|---|
static FastWindow attach(Component c) |
Attaches the native engine to a Java window/canvas. |
void setConstraints(minW, minH, maxW, maxH) |
Enforces kernel-level size limits. |
void setMaximizable(boolean) |
Enables/Disables the native maximize button. |
void setBackgroundColor(r, g, b) |
Syncs native background erase to your UI color. |
long getHWND() |
Returns the native window handle. |
| Platform | Status |
|---|---|
| Windows 10/11 (x64) | ✅ Fully Supported |
| Linux / macOS | 🚧 Not Planned (Win32 Specific) |
For detailed instructions on compiling the C++ JNI code, see COMPILE.md.
MIT License — See LICENSE file for details.
- FastCore — Native Library Loader for Java
- FastKeyboard — High-performance RawInput engine
- FastTheme — Advanced UI styling engine
Part of the FastJava Ecosystem — Making the JVM faster.