Skip to content

SourisCG/JavaVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽจ JavaFX Live Preview

Edit your FXML and CSSFX โ€” see changes instantly.
No compilation, no waiting. Just save and watch.

โœจ What it does

  • Open any .fxml file
  • Hot-reload FXML โ€” save โ†’ reloads instantly
  • Hot-reload CSSFX โ€” save โ†’ styles update without reloading the scene
  • Switch between FXML files โ€” dropdown lists all views in your project
  • Responsive viewport presets โ€” Phone (375ร—667), Tablet (768ร—1024), Desktop, HD, Custom
  • Auto-reload toggle โ€” one click to pause/resume watching
  • Error overlay โ€” shows load errors with a clear red banner

๐Ÿš€ Quick Start

# Open a specific FXML
java -jar javafx-live-preview.jar /path/to/login.fxml

# Or just pick one from the file chooser
java -jar javafx-live-preview.jar

Requires JDK 17 or newer. JavaFX is bundled in the JAR.

๐Ÿ“ฅ Download

Platform
Windows .exe .msi
macOS (Apple Silicon) .dmg
macOS (Intel) .dmg
Linux (Debian/Ubuntu) .deb
Linux (Fedora/RHEL) .rpm
Linux (any distro) .tar.gz

Installation

Pick your favorite way to install:

Windows

Option A: One-liner (PowerShell)

irm https://github.com/SourisCG/JavaVisualizer/releases/latest/download/JavaFXLivePreview-windows-x64.exe | iex

Option B: Download & double-click

  1. Download the .exe or .msi installer
  2. Double-click it
  3. Done! No admin rights required.

macOS

Option A: One-liner (Terminal)

curl -L https://github.com/SourisCG/JavaVisualizer/releases/latest/download/JavaFXLivePreview-macos-arm64.dmg -o ~/Downloads/JavaFXLivePreview.dmg && open ~/Downloads/JavaFXLivePreview.dmg

Option B: Download & drag

  1. Download the .dmg (Apple Silicon) or .dmg (Intel)
  2. Open it and drag to Applications
  3. First launch: Right-click the app โ†’ Open โ†’ Click "Open" (this is normal for unsigned apps, you only need to do this once)

Linux (Debian/Ubuntu)

Option A: One-liner

curl -L https://github.com/SourisCG/JavaVisualizer/releases/latest/download/JavaFXLivePreview-linux-amd64.deb -o /tmp/javafx.deb && sudo apt install -y /tmp/javafx.deb

Option B: Download & install

  1. Download the .deb file
  2. Double-click it or run sudo apt install ./JavaFXLivePreview-linux-amd64.deb

Linux (Fedora/RHEL)

Option A: One-liner

curl -L https://github.com/SourisCG/JavaVisualizer/releases/latest/download/JavaFXLivePreview-linux-x86_64.rpm -o /tmp/javafx.rpm && sudo dnf install -y /tmp/javafx.rpm

Option B: Download & install

  1. Download the .rpm file
  2. Run sudo dnf install ./JavaFXLivePreview-linux-x86_64.rpm

Linux (Any distro - Portable)

One-liner:

curl -L https://github.com/SourisCG/JavaVisualizer/releases/latest/download/JavaFXLivePreview-linux-x64.tar.gz | tar xz && ./JavaFXLivePreview/bin/javafx-live-preview

Or download & extract:

  1. Download the .tar.gz
  2. Extract it
  3. Run ./JavaFXLivePreview/bin/javafx-live-preview

Notes:

  • All Linux packages automatically install Java 17+ if needed
  • macOS users: The "app is damaged" warning is normal for unsigned apps. Just right-click โ†’ Open once.
  • Windows: No admin rights required

๐Ÿ”ง Build from source

git clone https://github.com/SourisCG/JavaVisualizer.git
cd JavaVisualizer
./gradlew shadowJar
# Output: build/libs/javafx-live-preview.jar

๐ŸŽฎ Usage

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ [Open...] [login.fxml โ–ผ] [Auto โ—Ž] [ Native โ–ผ ]          โ— OK   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                  โ”‚
โ”‚                    Your JavaFX scene                             โ”‚
โ”‚                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  1. Open... โ€” browse for an FXML file (or pass it as CLI argument)
  2. FXML selector โ€” switch between all .fxml files in the project
  3. Auto toggle โ€” enable/disable hot-reload
  4. Viewport โ€” simulate different screen sizes
  5. Status โ€” green dot = OK, red = error

๐Ÿ“ Supported project types

Works with any JavaFX project structure:

Type Detected by
Maven pom.xml in root
Gradle build.gradle in root
Plain Java src/ directory

The app auto-discovers:

  • All .fxml files in the project
  • All .css files (applied to the scene)
  • Classpath (target/classes, build/classes, bin) for controllers

๐Ÿ—๏ธ How it works

User saves file โ”€โ”€โ–บ Polling watcher (every 500ms)
                        โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ–ผ                   โ–ผ
        .fxml changed        .css changed
              โ”‚                   โ”‚
    FXMLLoader.load()    scene.getStylesheets().setAll()
              โ”‚                   โ”‚
         setRoot()           applyCss() + requestLayout()
              โ”‚                   โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ–ผ
                  JavaFX renders
  • No compilation โ€” only reloads FXML and CSS
  • No WebSocket / agent โ€” it's a single JavaFX app
  • No inotify โ€” uses polling (works everywhere)

๐Ÿ› ๏ธ Packaging

# Fat JAR (any OS)
./gradlew shadowJar

# RPM (Fedora/RHEL)
./packaging/linux/build-rpm.sh

# macOS DMG (generates .icns automatically)
./packaging/macos/build-dmg.sh

# Windows MSI + EXE (requires WIX Toolset + ImageMagick for .ico)
powershell -File packaging/windows/build-exe.ps1

See packaging/ for detailed instructions per platform.

๐Ÿ“„ License

MIT โ€” do whatever you want with it.


Made with โ˜• in JavaFX

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors