I'm trying to use Canvas and putting it into a JFrame.
The problem is that the JFrame is not packing the content I've drawn. The frame is small and I have to resize the window manually to see what's inside. Clues?
Mixing AWT and Swing used to be a bad idea and though I have heard rumors that it is not so dangerous these days I still don't do it. It is normal to use a JPanel instead of Canvas and override the paintComnponent(Graphics g) method rather than paint(Graphics g).
Joined: Jul 18, 2013
I've seen this guy using awt and Swing together. The game runs perfectly. I'm starting to suspect this is more of a urban legend.
Jframe is just the window border! How much do you think that will impact on performance?
I mean, having a good timer, good graphics and good engine is way better.
That said, this other guy uses JPanel instead of Canvas and the game runs equally smooth.
So, I still don't know wich to prefer, in developing games.
But more than that, why should any programmer want to use classes that were superseded by more modern counterparts more than a decade ago? There's nothing you can do with an extended Canvas that you can't do with an extended JPanel or JComponent.
There are no new questions, but there may be new answers.