This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mouseEntered method

 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Pie
Posts: 3222
12
Android Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47281
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:This particular subject is discussed in its Swing section mostly.
Agree. Moving.
 
linus dale
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic