⚡ 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.
- Why FastWindow?
- Key Features
- Performance
- Quick Start
- Installation
- API Reference
- Documentation
- Platform Support
- License
- Related Projects
FastWindow was built to solve the long-standing native limitations of the standard Java JFrame and Frame on Windows:
- 🌑 Title Bar Clutter — Standard Java frames cannot natively toggle Dark Mode, resulting in a white title bar clashing with dark themes.
- 🔆 Resizing Flicker — Java's
RepaintManagerclears the background with a white brush before drawing, causing strobing. FastWindow uses nativeWM_ERASEBKGNDhooks to eliminate this. - 📏 Soft Constraints — Java's
setMinimumSizeis enforced via async events, causing jittery snapping. FastWindow enforces limits at kernel level viaWM_GETMINMAXINFO. - 🎨 Lack of Modern Materials — AWT has no built-in support for Windows 11 Mica or Acrylic. FastWindow provides direct DWM integration via
FastTheme.
- 🪟 Fluid UI Scaling — Eliminates black traces and flickering during resize via a "Safe & Smooth" native scaling strategy.
- 📏 Kernel-Level Constraints — Enforces hard Min/Max window sizes directly in the Windows kernel for 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).
| Metric | FastWindow | Standard JFrame | Improvement |
|---|---|---|---|
| Resize Flicker | Zero (Native Erase) | High (AWT Erase) | Eliminated |
| Resize Latency | ~2 ms | ~16 ms | 8× Faster |
| Boundary Jitter | None (Kernel Level) | High (Event Level) | Butter Smooth |
import fastwindow.FastWindow;
public class Example {
public static void main(String[] args) {
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!
}
}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.0</version>
</dependency>
<!-- FastCore (Required Native Loader) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastCore</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastWindow:0.1.0'
implementation 'com.github.andrestubbe:FastCore:0.1.0'
}Download the latest JARs directly to add them to your classpath:
- 📦 fastwindow-0.1.0.jar (The Core Library)
- ⚙️ fastcore-0.1.0.jar (The Mandatory Native Loader)
Important
All JARs must be in your classpath for the native JNI calls to function correctly.
| 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 (HWND). |
- 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 | Status |
|---|---|
| Windows 10/11 (x64) | ✅ Fully Supported |
| Linux / macOS | ❌ Not Planned (Win32-specific) |
MIT License — See LICENSE file for details.
- FastCore — Native Library Loader for Java
- FastTheme — Advanced UI Styling Engine (DWM/Mica/Acrylic)
- FastUI — High-Performance Retained-Mode UI Framework
Part of the FastJava Ecosystem — Making the JVM faster. ⚡
