Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Canvas Vs Swing  RSS feed

shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guy's

I have design a panel(Say MainPanel).
Now i add a JComponent on a portion on MainPanel.
On the JComponent add 32 JPanel form left to right.On each JPanel draw a image.
Finally add the MainPanel to an InternalFrame which is visible when we click on a button.

Now come to problem when i click first time on button to visible InternalFrame
all work fine but when i press button again then it take too much time(In thread) or even stop responding in between i minimize the main frame it work fine.Now again press button problem come again.
i use SwingWorker on click of button.

I also solve the problem when i use Canvas instead of JPanel to draw images.
Then all work fine.

But i not understand logic behind this.I thing Canvas is AWT and JPanel is Swing component.Swing componet are slower than awt component. But i am not sure this is right reason behind this problem.

all of Your's openion is help me to understand login behind this.

Thank You
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!