views:

432

answers:

3

I am looking for a toolkit that will allow me to design widgets containing 2D graphics for an elevator simulation in Java. Once created, those widgets will be integrated with SWT, Swing, or QtJambi framework.

Background information:

I am developing an Elevator Simulator for fun. My main goal is to increase my knowledge of Java, Eclipse IDE, and more importantly concurrency. It is certainly fun and I enjoyed implementing this State Machine Pattern.

Anyway, I am at a point where I would like to see the Elevator on the screen and not limit myself to log its operations on the console.

I will probably choose SWT, Swing, or QtJambi for the UI controls but I am wondering what to do with the graphical part of the simulation.

+1  A: 

You can use an SWT canvas (or Swing canvas, or OpenGL canvas via JOGL, ...), and set it up as an Observer of your simulation, and whenever the simulation state changes, you can redraw the new state.

JeeBee
Yes, this is certainly an option but do some specialized toolkit for those kind of simulation exist so I don't have to start from scratch?
David Segonds
But at a basic level all you are doing is drawing a rectangle at a certain height within a lift-shaft rectangle. Maybe with doors opening and closing. Canvas as Observer is all you need.
JeeBee
A: 

Are you sure you actually want to be using widgets. Would using Graphics2D+friends and your own abstractions not be a better fit?

Tom Hawtin - tackline
This may be one option. Doing the graphic myself and then encapsulating into a widget. But I am wondering if some simulation graphic toolkits already exist.
David Segonds
+1  A: 

You could get some abstract graphics out of a Graph visualisation tool such as JGraph. You could use this to visualise which state your elevator is in. However, i'm not sure how flexible these sort of graph visualisation tools are and whether you can add your own graphics and animations.

Anthony Cramp