aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes mouseEntered method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
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
Bartender

Joined: Sep 13, 2007
Posts: 2615
    
    9

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 OCPJP7 OCPWCD5 OCPBCD5
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
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