Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
seems the only thing stopping it from compiling OK is the return statements,
where the method signature return value is void

 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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 ]
 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works OK using a mouseListener

 
Josh Crawford
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic