Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (736)
Games in Android Showcase (223)
games submitted by our members
Games in WIP (813)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Alternatives to Swing  (Read 2512 times)
0 Members and 1 Guest are viewing this topic.
Offline fletchergames

Senior Devvie

« Posted 2007-05-07 21:51:15 »

Swing doesn't seem as slow to me as some say it is.  However, there is at least one issue that could be faster: Swing has its own double buffering.  Shutting it off causes flicker even when I use a BufferStrategy.  I certainly don't need to double buffer twice.

The obvious alternative is the AWT.  The problem I have with the AWT is that it has only a tiny percentage of the features that Swing does.

One issue that I have with both AWT and Swing is the AWT Event Dispatch Thread.  Now that I know a bit about Swing, it's not that big of a deal, but it's still annoying.  I would rather call a method like "checkForKeyboardInput" than have AWT's passive input-checking.  This seems to be a common preference among game programmers.  I would rather not have the AWT Event Dispatch Thread and have everything included in my main loop with a few simple method calls.  Then I could use multithreading as needed and have it in my own control.

There's SWT, but that doesn't seem to be able to use full-screen exclusive mode.  It also isn't that much different from Swing.  Though it's better in some ways, it's also worse in others.

I've heard of various game programming libraries.  Slick seems to be the most programmer friendly.  Jogl and LWGL are very low level libraries that serve the same purpose.  Do any of these libraries (or others) include any alternative gui?

What is everyone else here using?  Though I can't change for the project I'm almost done with or the project that I'm going to revisit briefly, I may change we start our next new project.
Offline Riven

« JGO Overlord »

Medals: 1310
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2007-05-07 22:08:31 »

I think double-doublebuffering is the least of your problems. The last 'blit' of a big buffer to another big buffer should be 'fast enough' in most cases.

About the input-handling: I remember kevin glass wrote an input-framework that could be backed by quite a few implementations, like AWT/Swing, JInput and LWJGL. The front-end had methods like isKeyDown(...) and could iterate over the (queued) events.

I bet you'll find it somewhere on cokeandcode or newdawnsoftware, otherwise google might find it, or kevin himself might point you in the right direction!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline Linuxhippy

Senior Devvie

Medals: 1

Java games rock!

« Reply #2 - Posted 2007-05-07 22:26:58 »

I wrote a quite large project using LwVCL
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline broumbroum

Junior Devvie

« Reply #3 - Posted 2007-05-07 22:58:23 »

I've been developing under Java2 for a while with AWT/Swing libs to make a small 2Dimensional game framework, LJGWL-like but on my own.
It is seemly important to use DBffr' for any real-time Graphics application, if you intend to get an user.friendly interface.

So I also faced the EDT issues about refresh speed, both with AWT and Swing. Therefore I looked for another way to render components, and that is, JCSP which involves USA students in the project. JCSP for Java communicating seuential processes renders Java components throughout an integrated Channels-Processes network that make the Components Active.

You can find some piece of my work-in-progress at listed below. I'm about to get the graphics rendering active. And also at JCSP they're gonna get out of the Swing implementation of their project.

::::... :..... :::::: ;;;:::™ b23:production 2006 GNU/GPL @
on /projects/sf3jswing
Java (1.6u10 plz) Web Start pool
dev' VODcast[/ur
Offline fletchergames

Senior Devvie

« Reply #4 - Posted 2007-05-08 18:20:56 »

I've written my own "GameKeyListener" with methods like isKeyPressed, wasKeyReleased, etc.  It's mostly the strange weirdness that happens from time-to-time that I don't like.

For instance, I added my KeyListener to every component in my game due to focusing issues.  It wouldn't be a problem if I just drew whatever I wanted onto the JFrame, but I use actual Swing components.  I request focus as necessary and make as many components as possible unfocusable, but it doesn't work well enough.

Since I'm detected key presses no matter what screen is being displayed (each "screen" is a different card in a card layout), I was detecting Escape key releases on the menu screen (the Escape key is used in the game screen to go to the menu screen).  This caused the game to freeze after returning to the game screen.  I don't know exactly why this happened, but explicitly checking for input in the menu screen (and then ignoring the input) fixed this bug.  It shouldn't have mattered because I was clearing the input when I shifted screens anyways, but it did.

That's a problem I fixed, but it was annoying.  I want the power of Swing without having to use code I don't understand.  I've learned more about Swing, but not enough to write perfect code.  It's just one of those problems we all have to deal with.

I have tried writing my own gui code in both C and Java.  I've had some limitted success, but Swing is by far better.  That's not much of a surprise as it was written by professionals.  Still, I like having complete control of my code.

LwVCL seems like an acceptable alternative to Swing.  Some items look strange when selected, but that's probably configurable.

JCSP seems to claim to magically fix the multithreading issues I was complaining about.

Both libraries seem to still use the AWT in some way.  They also both seem to have no tutorials, but they do have javadoc-created documentation.  I think it wouldn't be too hard to figure out either one of them.

It's weird, but I think what I really want is to implement most of the same features myself but in a vastly different way.  From previous experience, I know that it would probably take me years and that I would probably just find out that I like the already available ways better.

If I had a little bit more than 10 times the amount of money I have now, I could live at poverty level indefinetly from the interest alone (if I ignore inflation).  And then I could do sit down and write my own gui library.  As it is, I guess I'll take some time after my current project's done to try out some of the libraries mentioned and see which one is the best for me.
Offline cylab

JGO Kernel

Medals: 173

« Reply #5 - Posted 2007-05-08 23:11:25 »

If you just need a GUI in your game and are not searching for a general purpose swing replacement, FengGui seems to provide a reasonable set of GUI components for OpenGL games.

Mathias - I Know What [you] Did Last Summer!
Offline fletchergames

Senior Devvie

« Reply #6 - Posted 2007-05-10 16:00:01 »

FengGui looks ok, and seems to be better documented than the other options.  I've added it to my list of libraries to look at.

I think I'll have to include the full embedded JRE anyways to satisfy Sun's license, so replacing Swing completely wouldn't help me that much.
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

cybrmynd (120 views)
2017-08-02 12:28:51

cybrmynd (144 views)
2017-08-02 12:19:43

cybrmynd (139 views)
2017-08-02 12:18:09

Sralse (154 views)
2017-07-25 17:13:48

Archive (624 views)
2017-04-27 17:45:51

buddyBro (733 views)
2017-04-05 03:38:00

CopyableCougar4 (1260 views)
2017-03-24 15:39:42

theagentd (1240 views)
2017-03-24 15:32:08

Rule (1216 views)
2017-03-19 12:43:22

Rule (1269 views)
2017-03-19 12:42:17
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!