As can be seen from the Canvas
class and the JFrame
class, the methods related to BufferStrategy
(of the Canvas
and of the JFrame
) don't come from the same parent.
The createBufferStrategy
of JFrame for example, is inherited by Window
, which is not a parent of Canvas
, while Canvas
implements its own. Actually, their last common ancestor is Component
which doesn't have this method.
So I'm wondering whether the functionality of the two is the same, and whether my program will behave the same when replacing the createBufferStrategy
/getBufferStrategy
of the Canvas
with the createBufferStrategy
/getBufferStrategy
of the Window
.
I've decided to do this "replace move" because I read yesterday JPanel
is no slower than Canvas
here: Canvas and InputMap.
So I basically want to add JPanel
instead of Canvas
now.
When I started coding, my first choice was Canvas
because of this:
tutorial on youtube. So you can see more or less my code there, even though I've done a few changes, as they are not related to this topic.