canvas vs jpanel pros and cons

I heard that I don't should mix awt and swing. Is canvas "old" because it is awt? did canvas have something that jpanel don't have? is canvas better/faster in rendering? jpanel has double Buffering per default how about canvas? and especially what is better for games?

5/10/2019 1:44:22 PM


1 Answer

New Answer


JPanel can also do drawing. But they are more for laying out other components. Even you used JPanel to paint you are still depend in awt's paint method (directly or overriden methods) And I don't think that you should not mix awt and swing together. So according to me using canvas is more better