r/javaswing • • Jan 08 '26

showcase Kotlin Wrapper for Java Swing (swing-plus)!

1 Upvotes

I’ve been experimenting with a small Kotlin library called Swing+ — a lightweight way to write Swing UIs using a cleaner, more declarative style. Coming from using Java Swing, the imperative nature is way too verbose and can be greatly simplified with Kotlin, so I experimented with using a Compose-Style for writing Swing Components. There is a basic state management, but the overall focus is on reducing the imperative nature of so many setters.

Here is a quick example:

Creating a simple vertical layout with two buttons

col {
    +button("Button 1") { println("Hello!") }
    +button("Button 2")
}
val count = remember(0)
val label = label("Count: ${count()}")

count.observe {
    label.text = "Count: ${count()}"
}

+scaffold(
    center = { +label },
    south = {
        +button("Increment") {
            count(count() + 1)
        }
    }
)

I would greatly appreciate feedback!

If you want to take a look or try it out: https://github.com/exoad/swing-plus


r/javaswing • • Jan 15 '26

Update: I finished v1.0.0 of my modern Swing component library (No external dependencies)

3 Upvotes

Hi everyone,

I posted a preview here of a project I was working on to modernize Swing's appearance using pure Java 2D. I’m happy to share that the first version of Swing Remastered is finally complete.

The Philosophy: Instead of creating a complex custom LookAndFeel (which can often break legacy layouts), I decided to extend the standard Swing components (JButton -> JRButton, etc.) and rewrite the paintComponent() logic from scratch.

What’s under the hood:

  • Rendering: Full support for anti-aliasing, drop shadows, and rounded corners natively.

  • Animation Engine: A custom built engine handles transitions (hover, click) smoothly without.

Availability: This is a source-available project. I’ve set a small license fee (10€) for individual use to support the development and email support, but the goal is to provide a drop-in modernization for anyone sticking with Swing over JavaFX.

Repo: https://github.com/myvalovec/Swing-Remastered-library

I’d appreciate any feedback! ❤️


r/javaswing • • Apr 10 '26

love this "tech stack"

Post image
19 Upvotes

HTML/CSS are great, but I will never use Electron.


r/javaswing • • Feb 18 '26

Swing Modernization Toolkit — run Swing apps in the browser, then migrate view-by-view. Anyone planning to try this?

Thumbnail
reddit.com
2 Upvotes

r/javaswing • • Jan 05 '26

I cant stand Swing's default look, so I’m building a zero dependency component library.

5 Upvotes

Hi everyone,

I'm working on a project to modernize Swing apps without needing external libraries or Maven/Gradle.

It works by overriding the default paintComponent() method and using Graphics2D.

The goal: Create single .java files that anyone can drop into any project to replace standard components with this modern redesign.

Current redesigned components:

  • JButton

  • JCheckBox

  • JTextField

  • JScrollBarUI

  • JPanel

The video above contains a small app for a clear comparison between normal swing(left) and my enhanced version(right).

Questions: Your honest opinion? Which components would you like to see next?


r/javaswing • • Sep 10 '26

Kromium – A zero-bloat Chromium engine for Java applications

1 Upvotes

Hey everyone,

Embedding a reliable, modern web view in Java desktop apps usually means dealing with massive binaries, fragile JNI/JOGL dependencies, and clunky setups. To solve this, I just open-sourced Kromium (daviantegroup/kromium).

It is built from the ground up for the JVM. Whether you are using pure Java, or modern Kotlin/Compose, Kromium provides a seamless embedding experience.

Here are the main features:

* Tiny Installers (15–30MB): Instead of bundling massive Chromium binaries, Kromium automatically downloads and caches the native JCEF runtime on the user's first launch.

* Clean JS Bridge: Thread-safe JavaScript execution and Inter-Process Communication (with a Java-friendly API and Kotlin coroutine support).

* True Headless Mode: Perfect for Java-based backend scrapers, automation, or testing without pulling in heavy UI dependencies.

It's available under the Apache 2.0 license. I’d love for you to check out the repo, run the demo, and let me know what you think!

🔗 https://github.com/daviantegroup/kromium


r/javaswing • • Oct 02 '26

Quarkus Desktop is out! Build AWT/Swing apps with CDI, Dev Mode, and hassle-free GraalVM Native Executables 🚀 Spoiler

9 Upvotes

Hey everyone,

PS: Two days ago I was looking to add some "Web API" capabilities into a Java Swing based Point of Sales and a found this extension (quarkus-desktop). u/quarkus

For decades, AWT and Swing have been the backbone of many powerful desktop applications. However, modernizing them—especially trying to compile them into GraalVM native executables—has always been a painful journey. Managing reflection, JNI callbacks, and OS-specific resources by hand for GraalVM is incredibly tedious.

That is why the Quarkus community just launched Quarkus Desktop!

It is a brand new official Quarkiverse extension designed to bring the absolute best of modern Java development (CDI, live reload/dev mode, centralized configuration) straight into AWT and Swing desktop apps.

🌟 Key Features:

  • True Native Executables: It completely automates the heavy lifting for GraalVM. It registers all necessary reflection, fonts, images, drag-and-drop, and clipboards for Windows, Linux, and macOS.

  • **Windows & Window Management:**No more public static void main. Windows are treated as standard CDI beans (@Singleton or @Dependent) that observe a DesktopStartupEvent fired automatically on the Event Dispatch Thread (EDT).

  • Thread Safety Made Easy: Swing requires everything to run on the EDT. Quarkus Desktop introduces an injected EdtExecutor (works great with CompletableFuture or Mutiny) and a @RunOnEdt annotation to automatically offload background work and return safely to the UI thread.

  • Native OS Integrations: Seamlessly handles macOS application menus (About, Preferences, Quit requests) by firing them as standard CDI events.

  • Rock Solid Stability: The extension is backed by a massive showcase app containing 75 pages and ~3,800 automated checks compared pixel-by-pixel between JVM and Native modes across all operating systems.

💻 Quick Code Preview:

import io.quarkiverse.desktop.awt.DesktopStartupEvent;

import jakarta.inject.Singleton;

import javax.swing.*;

@ Singleton

public class MainWindow extends JFrame {

@ Inject

MyBackendService service;

void open(@Observes DesktopStartupEvent event) {

setTitle("Quarkus Powered Swing App");

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

add(new JScrollPane(new JList<>(service.getData())));

pack();

setVisible(true);

}

}

🔗 Official Links to check it out:

What do you think about this approach? Could this help you breathe new life into older enterprise Swing systems or build lightweight native utilities?


r/javaswing • • Feb 08 '24

Swing in the JDK

1 Upvotes

I read that JavaFX was removed from the JDK and was just wondering why Swing remains in it?


r/javaswing • • Oct 27 '23

I made this

6 Upvotes

In my free time, I add lines of code to a personal player that I have and I have long since added the ability to download songs from slider.kz

Use the discogs API the results are cached in the user root as well as the images and all that using Project Reactor, the libraries used are varied but as for Swing, it is only FlatLaf and the other libraries it has and MigLayout and a quantizer to detect the color of the cover

I forgot to add that I am not using the java audio api, I use Bass Audio Library loading the dlls with JNI


r/javaswing • • Nov 14 '23

Best Layout Manager?

1 Upvotes

I’ve been working on a swing project for a few months now and I’m always swapping between GridLayout, GridBagLayout and BorderLayout.

I’m finding it quite time consuming to select the correct manager and then getting my components all laid out and in line.

Is there a good method for efficient layout managing?


r/javaswing • • Sep 11 '23

Welcome to r/javaswing

4 Upvotes

Hello developers

This is a subreddit dedicated to Java Swing developers and users.

Post your questions about the framework or general discussion about it!


r/javaswing • • 19d ago

Swing help. Image gets distorted when partially outside window.

3 Upvotes

I have a JPanel class that draws an image on screen with camera panning. The camera is zoomed in. The image being drawn is a 16x16 Minecraft dirt.

When the image is entirely inside the window, it looks fine. When partially outside the window, it distorts and makes the image narrower to fit it inside the window. Eventually it snaps to the next pixel.

Does anyone know why this happens and how to fix it?

I'm using:
MacBook Air M1
Java 25
IntelliJ

The entire class is below.

Edit: Solved. The issue seems to only affect Mac. Running with java -Dsun.java2d.metal=false CompiledClass fixes the problem.

public class CameraPanel extends JPanel{
    public static void main(String[] args) throws IOException{
        JFrame frame = new JFrame("Camera");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(new CameraPanel());
        frame.setSize(300, 300);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }

    private double cameraX, cameraY;
    private double zoom = 10.0;
    private Point lastMousePosition;
    private BufferedImage image = ImageIO.read(new File("src/test/resources/dirt.png"));

    public CameraPanel() throws IOException{
        addMouseListener(new MouseAdapter(){
            public void mousePressed(MouseEvent e){
                lastMousePosition = e.getPoint();
            }
            public void mouseReleased(MouseEvent e){
                lastMousePosition = null;
            }
        });
        addMouseMotionListener(new MouseMotionAdapter(){
            public void mouseDragged(MouseEvent e){
                if(lastMousePosition == null){
                    return;
                }
                cameraX += e.getX() - lastMousePosition.x;
                cameraY += e.getY() - lastMousePosition.y;

                lastMousePosition = e.getPoint();
                repaint();
            }
        });
    }

    
    protected void paintComponent(Graphics g){
        super.paintComponent(g);
        Graphics2D g2 = (Graphics2D) g;
        g2.setRenderingHint(
                RenderingHints.KEY_INTERPOLATION,
                RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
        );

        AffineTransform transform = new AffineTransform();
        transform.translate(cameraX, cameraY);
        transform.scale(zoom, zoom);

        g2.drawImage(image, transform, null);
    }
}

r/javaswing • • 23d ago

Swing in the wild

4 Upvotes

r/javaswing • • May 28 '26

Dragging colors from Swing to a native widget

Thumbnail bonsaimind.org
2 Upvotes

r/javaswing • • Jan 18 '26

Java Swing Game

4 Upvotes

I made it with Java Swing. What do you think?

https://progencel.itch.io/flappy-dog