GUI for active rendering in Java2D

I wrote a basic little artillery game in Java2D which runs well and looks pretty good. Then I went to add some GUI elements to it. Swing doesn’t really work under active rendering. Does anyone know of any good GUI toolkits that will work with active rendering?

Not the end of the world if there’s nothing available - I’ll just convert the code to libgdx or lwjgl. That said, it runs great now so I’d like to avoid rearchitecting unless I absolutely have to.

I think a lot of times people have the main application utilize the standard swing GUI elements and such, or whatever standard toolkit of your choice

and then have an embeddedpanel in the screen, which utilizes active rendering.

Nope none that I know of. Back when I used to use Java2D, I simply created my own GUI “framework” that just consisted of a Button, Label, and Slider with update and render methods.

that’s what I started doing before I figured it wasn’t the best use of my time :o)

Java2D isn’t the best use of your time… :-\

My game is looking good and running at hundred to thousands of frames per second. There’s nothing wrong with Java2D for the right kind of game.

FTFY

namrog84’s suggestion is the way to go. Use a standard JFrame with normal Swing components and put your active rendered code on a panel by itself.

You can tell Swing to do active rendering (although the article is in the “fullscreen” section, it works under windowed mode too!):
http://docs.oracle.com/javase/tutorial/extra/fullscreen/rendering.html

Here is how to disable passive rendering:

[quote]Use the setIgnoreRepaint method on your application window and components to turn off all paint events dispatched from the operating system completely, since these may be called during inappropriate times, or worse, end up calling paint, which can lead to race conditions between the AWT event thread and your rendering loop.
[/quote]

Thanks for the suggestions, guys.

I decided not to go for the idea of having the active rendered content on another panel - that doesn’t work for my design.

@noblemaster: yeah, I’ve read that stuff already: it doesn’t work, or at least it didn’t for me.

I’ve gone with refactoring the code into LWJGL code, rather than compromising the design. It’s been pretty easy: I just set the viewport upside down and the coordinates are all the same as the Java2d version so the code is happy.