Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (582)
Games in Android Showcase (163)
games submitted by our members
Games in WIP (633)
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  
  Java2D UI library without Swing, and runs in sandbox  (Read 3347 times)
0 Members and 1 Guest are viewing this topic.
Offline CommanderKeith
« Posted 2010-08-11 07:13:11 »


Does anyone know of a UI library, or at least a bunch of components that don't use Swing, are painted using Java2D and can run in the security sandbox?

The closest that I've seen is in Pulpcore ( I was thinking of asking David Brackeen if I could rip off his widgets and re-factor them to make it render using regular java2D.

I know about PureSwing ( but it requires all-permissions.

I also know about the openGL ones (TWL, FenGUI) but I'd like a java2D-rendered UI.


Online Riven
« League of Dukes »

« JGO Overlord »

Medals: 973
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2010-08-11 07:38:25 »

What do you want to do with it? You can customize Swing components to match your look and feel, so maybe you can elaborate on why you absolutely don't want to use Swing Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline CommanderKeith
« Reply #2 - Posted 2010-08-11 09:10:49 »

Mostly because swing is a mess. It's too difficult to control when it is painted, which thread it's painted in, what events it gets, what is painted.

I've hacked it up before to try and make it do direct rendering (rendering outside of the Event Dispatch Thread) but it was very messy, and it is not meant to be done according to the API.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online kappa
« League of Dukes »

JGO Kernel

Medals: 87
Projects: 15


« Reply #3 - Posted 2010-08-11 10:45:24 »

There is the Thinlet GUI library. It was famous for being a single class, not sure if its still the case but is a small fast lightweight java gui.

It also has a slick2d port called Thingle which is useful if you later decide to move over to opengl.
Offline CommanderKeith
« Reply #4 - Posted 2010-08-11 11:30:55 »

That does look pretty good, thanks for pointing it out. What a pity that it's GPL Sad

How strange, on the Thinlet website it says that it's GPL, but on the thingle site it says that its LGPL  Huh Maybe the old version of thinlet was LGPL...

Online kappa
« League of Dukes »

JGO Kernel

Medals: 87
Projects: 15


« Reply #5 - Posted 2010-08-11 11:35:59 »

That does look pretty good, thanks for pointing it out. What a pity that it's GPL Sad

How strange, on the Thinlet website it says that it's GPL, but on the thingle site it says that its LGPL  Huh Maybe the old version of thinlet was LGPL...

there is an older version still available here which is LGPL.
Offline CommanderKeith
« Reply #6 - Posted 2010-08-11 11:54:24 »

Thanks kapta!

Offline markus.borbely

Junior Devvie

« Reply #7 - Posted 2010-08-22 17:01:24 »

I have made a framework in java2d. At this time it is mostly for me but that can be changed.

A brief introduction to its design:
The main class is a Screen. Subclass it for each game state (menu, profiles, high scores, actual game, inventory screen etc). It takes care of updating and painting.
Also it listens (with empty methods like an adapter) to mouse and keyboard, simply override what you need and you will be notified. The screen controls the flow between screens, you can goto and call other screens.

So far nothing special. But, a screen can have what I call SubScreens. A SubScreen is a small rectangle that is painted, updated and informed of input events.
A SubScreen can be invisible. Then it will not be painted(!!!) :-)
A SubScreen can be disabled, then it will not get input events.
A SubScreen can be focusable, then it can receive keyboard focus. (some other rules for this also applies, if no object have focus, the subscreen under the mouse gets the keyboard events first and can consume it).
A SubScreen operates inside it's own coordinate system. This means that when it gets mouse events they are translated to be relative its local origo. This also holds true for painting. So paint from 0,0  and then move the SubScreen around, it still works.

I have made a number of special subclasses from SubScreen:
StyledSubScreen (for widgets that have text)
TextField (single line of editable text)
Button (you still have to paint it to make sense, just override the paint method)

Also, a subscreen can implement the interfaces DragSource and/or DragTarget. When dragged from it returns a Draggable object (interface draggable). When dropped on a SubScreen implementing the DragTarget interface, this object is notified. You still have to do the plumbing behind. But it works very well for the inventory system I am currently working on.

Is this near what you are looking for?
Offline markus.borbely

Junior Devvie

« Reply #8 - Posted 2010-08-22 17:11:20 »

A screenshot showing a multitude of different custom widgets. Most are clickable, some can be dragged etc.
Offline CommanderKeith
« Reply #9 - Posted 2010-08-22 19:45:34 »

That sounds pretty cool, especially the widgets you've made which is what I'm looking for. TextFields are hard to make.

Nice screen shot. I like top-down view games.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Ralphanese (17 views)
2015-05-29 13:07:55

Gibbo3771 (15 views)
2015-05-29 06:54:17

Ralphanese (23 views)
2015-05-28 16:52:52

theagentd (31 views)
2015-05-27 22:21:17

theagentd (35 views)
2015-05-27 22:21:08

CopyableCougar4 (25 views)
2015-05-27 19:24:50

MrMapcom (24 views)
2015-05-23 20:26:16

MrMapcom (32 views)
2015-05-23 20:23:34

Waterwolf (37 views)
2015-05-20 15:01:45

chrislo27 (44 views)
2015-05-20 03:42:21
Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02 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!