aspose file tools
The moose likes Swing / AWT / SWT and the fly likes mousePressed and responding to it Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "mousePressed and responding to it" Watch "mousePressed and responding to it" New topic
Author

mousePressed and responding to it

Rene Ott
Greenhorn

Joined: Apr 20, 2012
Posts: 8

When I create and event and I respond it with method mousePressed() then what is difference between these two:





Could anyone explain me, what is happening in the second code
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Welcome to the Ranch!

Well, the difference is that one example repaints the source always, and the other only if it's one specific panel. I think you can figure out which is which.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Rene Ott
Greenhorn

Joined: Apr 20, 2012
Posts: 8

For example, if I have Applet with two panels, then the second code repaints that panel where the click was made. Am I right?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Am I right?

what happened when you tried it?
Rene Ott
Greenhorn

Joined: Apr 20, 2012
Posts: 8

I didn't have chance before to try out. That's why the question was before experiment. But yes, I was right. Thanks for help ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mousePressed and responding to it
 
Similar Threads
How to add MouseLsitener to JMenu
Learning to use Drag and Drop
How to get default menu items from JDialog?
Jpanels and Jscrollpanels
Custom JComponent