Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
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 3051 times)
0 Members and 1 Guest are viewing this topic.
Online CommanderKeith
« Posted 2010-08-11 07:13:11 »

Hi,

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 (http://www.interactivepulp.com/pulpcore/api/). 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 (http://www.java-gaming.org/topics/pureswing/21430/view.html) but it requires all-permissions.

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

Thanks,
Keith

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
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
Online 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
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
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.
Online 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...

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
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.
Online CommanderKeith
« Reply #6 - Posted 2010-08-11 11:54:24 »

Thanks kapta!

Offline markus.borbely

Junior Duke





« 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:
FocusableSubScreen
Label
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)
Checkbox

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 Duke





« 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.
Online 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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (38 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!