I don’t want to get called events during the render or update step, but before them. I also don’t want to only redraw when an event has occurred, but as soon as possible, so I need a loop in my program.
- poll events – call functions to associated listeners
- update – may be merged with draw
- draw
How can I accomplish this?
I don’t really understand your problem, but if you want to draw continuously, then you should make a main loop. This thing cannot be made with swing components, but only if you design an event or use a predefined event. In that event, redraw the whole canvas, using
validate()when you add a new component andrepaint()orpaint()when you just want to update the image.If you don’t want to render continuously then just render when “something” happens, such as when an event triggers.