wood burning stoves 2.0*
The moose likes Java in General and the fly likes Colour picker, MouseDown(Event, int x, int y) Depreciation Help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Colour picker, MouseDown(Event, int x, int y) Depreciation Help!" Watch "Colour picker, MouseDown(Event, int x, int y) Depreciation Help!" New topic
Author

Colour picker, MouseDown(Event, int x, int y) Depreciation Help!

Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Hi,
I'm working on an assignment for school...one of the applets i have to develop is a colour picker...But unfortunately i'm having some trouble with it...

I would just like to ask if anyone could help me along a little bit and give me some insight as what to do to change this into the non-depreciated format...

I've looked up on the list here, http://java.sun.com/j2se/1.4.2/docs/...ated-list.html, and it states it has been replaced with processMouseEvent(MouseEvent).

I've tried to replace this with this code, but i get error after error..
Could anyone help me with this? I'm hitting a brick wall...
here is the whole applet if you want to have a look...i would REALLY appreciate it if someone could point me in the right direction at least, im not having much luck...


Here is my (pathetic) effort of trying to recode my program, but it doesnt work at all anymore...






If anyone wants to look at the original code, feel free to ask!

Thanks for anyone having a look at this, i really REALLY appreciate it!

Thanks in advance!!

-Crawf
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
seems the only thing stopping it from compiling OK is the return statements,
where the method signature return value is void

Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
ah yes, the original code here was a boolean instead of void for the statement, thats why it has the return statements in there...I tried keeping the boolean, rather than replacing with void, but there was a compile error, so i had to change it to void...

the original method...




Hope that helps!

-Crawf
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296


It would help if you posted the text of the compiler error you are experiencing. From what I can see, you call getX() and getY() but don't assign the return value from those method calls to any variables, then you go on to use the undeclared variables y and x. Also, as was already stated, you can't have a return statement in this method.
[ June 07, 2006: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Well, if i compile the applet, the error is 'cannot return a value from whose result type is void' fair enough, thats pretty self explanatory...

after removing the two return statements, "return false;" and "return true;" there are no compile errors, but the mouse method no longer works...if you try it, you can see what i mean!

Do you have any ideas on how i can make the applet work again? i'm at a loss..

-Crawf
[ June 07, 2006: Message edited by: Josh Crawford ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
works OK using a mouseListener

Josh Crawford
Greenhorn

Joined: Jun 07, 2006
Posts: 11
wow!! it worked great!

I can see how you solved it, i should have thought of that...mainly the



was what i was missing...

Thank you SO much! you've helped me so much! I really appreciate your time spent on this!

-Crawf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Colour picker, MouseDown(Event, int x, int y) Depreciation Help!
 
Similar Threads
How to code a button with image
I'm fazed by a nullpointererror I can't get rid of
how to make zooming slowly
Placing an image object on canvas(urgent)
Newbie in need of help