Skip to content

andrestubbe/FastWindow

Repository files navigation

FastWindow v0.1.0 [ALPHA] — Native Windows Window Engine for Java

Status License: MIT Java Platform JitPack


⚡ 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.


FastKeyboard Showcase


Table of Contents


Quick Start

import fastghostmouse.FastGhostMouse;

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!
    }
}

Why FastWindow?

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 RepaintManager often clears the background with a white brush before drawing, causing intense flickering. FastWindow uses native WM_ERASEBKGND hooks to eliminate this.
  • 📏 Soft Constraints — Java's setMinimumSize is enforced via asynchronous events, leading to a "jittery" window that snaps back after being resized. FastWindow enforces limits at the kernel level via WM_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 FastTheme module.

Key Features

  • 🚀 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).

Performance

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

Installation

Option 1: Maven (Recommended)

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>v0.1.0</version>
</dependency>

<!-- FastCore (Required Native Loader) -->
<dependency>
    <groupId>com.github.andrestubbe</groupId>
    <artifactId>fastcore</artifactId>
    <version>v0.1.0</version>
</dependency>
</dependencies>

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:fastwindow:v0.1.0'
    implementation 'com.github.andrestubbe:fastcore:v0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest JARs directly to add them to your classpath:

  1. 📦 **fastwindow-v0.1.0.jar ** (The Core Library)
  2. ⚙️ fastcore-v0.1.0.jar ( The Mandatory Native Loader)

Important

All JARs must be in your classpath for the native JNI calls to function correctly.

Try the Demo

Want to see the native resizing in action?

  1. Clone this repository.
  2. Run run-demo.bat.
  3. Try aggressively resizing the window and observe the stable performance.

API Reference

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.

Documentation

  • COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
  • REFERENCE.md: Full API descriptions, border configurations, and codepoint index.
  • PHILOSOPHIE.md: The engineering rationale for zero-allocation performance.
  • ROADMAP.md: Future milestones and planned features.

Platform Support

Platform Status
Windows 10/11 (x64) ✅ Fully Supported
Linux / macOS 🚧 Not Planned (Win32 Specific)

Building from Source

For detailed instructions on compiling the C++ JNI code, see COMPILE.md.


License

MIT License — See LICENSE file for details.


Related Projects


Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

High-performance native Win32 window engine for Java. Turbocharges JFrame with flicker-free resizing, kernel-level constraints, and fluid UI scaling. Part of the FastJava ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors