Canvas vs. JPanel
843805Feb 28 2007 — edited Mar 1 2007Hi 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