3

I am looking for a dedicated drawing surface in Java to draw 2D very fast in succession, very much like Android's SurfaceView. I have been using JPanels but I am not sure about the performance and efficiency when calling repaint() multiple times. The documentation says that:

If this component is a lightweight component, this method causes a call to this component's paint method as soon as possible. Otherwise, this method causes a call to this component's update method as soon as possible.

Note the as soon as possible. I want instantaneous. Using the SurfaceView in Android I had full control of the Canvas and could draw when I wanted.

Should I be using for instance the Canvas from AWT or JComponent from Swing, or something else? Note that I want a dedicated drawing area and I do not care about other compontents. I would like to register mouse events though. And again, I want the full control to draw on the area without having to call repaint or some other method, like I do with SurfaceView on another Thread.

I asked a similar question but now I feel like I can be more specific thanks to the answers from that question.

Community
  • 1
  • 1
Simon Zettervall
  • 1,764
  • 1
  • 15
  • 31

0 Answers0