943,975 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4372
  • Java RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Nov 1st, 2008
0

Re: Mouse listener

http://java.sun.com/j2se/1.4.2/docs/...eListener.html

Thats the Javadoc for MouseListener. Now, you tell me, what method should your code go if you want something to happen when the user clicks the mouse?
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Nov 1st, 2008
0

Re: Mouse listener

I know the code goes in mouseClicked(MouseEvent e)
My question is what would my code be like in that method? any help, sir???
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
complexcodes is offline Offline
57 posts
since Mar 2008
Nov 2nd, 2008
0

Re: Mouse listener

I'm really not sure how you would do that. You should look into the documentation for the various methods you've been using, such as the ones that you are currently using in your paint method. For example, what would happen if you set both the rectangle's length and width to 0 then called repaint? It seems like this would lead to a rectangle with 0 area, which would be painted as nothing on your screen. That probably isn't the best way to go about things, in fact - probably the worst way you could do it - but it will probably work. If you want a better solution, which I'd hope you do, then look into the methods you are using. They have documentation which tells you what happens based on the parameters.
Last edited by BestJewSinceJC; Nov 2nd, 2008 at 1:57 am.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: can anyone find my mistake in TrainingZone.java
Next Thread in Java Forum Timeline: Need help from java expert





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC