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

mouseEntered method

linus dale
Ranch Hand

Joined: Jul 01, 2009
Posts: 44



doubt
line no. 68 to 69
is this
Button b=((Button)e.getSource());
typecasting
what does this line do?
what is the use of getSource,getLabel,setText
K. Tsang
Ranch Hand

Joined: Sep 13, 2007
Posts: 1219

For events like mouse events, e.getSource() refers to component which fired the event. So say if you have a button and attach a MouseListener to it like below .... then the MouseEvent e.getSource would be a Button.



The casting is make sure the event is indeed a button and not object.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Linus, you've been asking quite a few starter questions lately. Perhaps it is a good idea to read through the Java Tutorial. This particular subject is discussed in its Swing section mostly.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32604
    
    4
Rob Prime wrote:This particular subject is discussed in its Swing section mostly.
Agree. Moving.
linus dale
Ranch Hand

Joined: Jul 01, 2009
Posts: 44
Rob Prime wrote:Linus, you've been asking quite a few starter questions lately. Perhaps it is a good idea to read through the Java Tutorial. This particular subject is discussed in its Swing section mostly.

thanks
problem is I am a not much of a reader
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mouseEntered method
 
Similar Threads
setting contents visible/invisible
Event handling
jdbc
see this very simple code.
jar file not working