I wonder which class btw Canvas and JPanel is better to draw a playing cards?
Thanks
I wonder which class btw Canvas and JPanel is better to draw a playing cards?
Thanks
Either! Although a Canvas belogns to java.awt, while JPanel is part of javax.swing.
I’d suggest JComponent over JPanel, actually.
For what reason? Less overhead maybe?
Thanks for all quick answers 
A playing card simply need to display an image and response to mouse event. I just want to use the right tool for the job. I consider JPanel a bit wasted for drawing a card. Can you give me technical proof of your choice ?
you might get better perf’ with a simple Canvas than Components over a Panel. Canvas can be added to any Container including the Panel.
Canvas has an opaque property and gets directly to VRAM buffers. While JPanels may have a simplier approach and Double Buffering, its still a good idea to try an impl. of Canvas because of all the constraints you can encounter with Layout etc. BTW cards game don’t use much VRAM since it is pretty statical to display a game-card !!! LOL