Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Canvas vs. JPanel

843805Feb 28 2007 — edited Mar 1 2007
Hi everyone,
I am new to Swing and Graphics. recently I am trying to design a mutiple window GUI. I use JDesktopPane and JInternalFrame. I try to draw contours onto a Canvas or JPanel whis is itself added to the IInternalFrame.
Since Canvas is AWT so when write pure Swing I should use JPanel, that is my understanding. To my dismay, when I use Canvas and draw the contours by overwritting paint() method my contours can be drawn rather fast, However, when I use JPanel and paintComponent method the drawing is much slower. Worse, when I resize or move the internalFrame the JPanel is really slow, almost frozen.
What is the problem? Any suggestion is greatly appreciated!!

Thanks in advance

Taogo
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 29 2007
Added on Feb 28 2007
4 comments
553 views