From: Sanny on
I was using mousedown() As Below.

----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
public boolean mouseDown(Event evt, int x,int y){

----- OLD CODE
----- OLD CODE
return true;
}
----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


Above code works correctly. Now I found somewhere mousedown is
depriciated. And I thought of changingf to

processMouseEvent() fiunction

I used below Code. And replace mousedown() by
processMouseEvent(MouseEvent event)

NEW CODE
---------------

----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

public void processMouseEvent(MouseEvent event) {

int x=event.getX();
int y=event.getY();

----- OLD CODE
----- OLD CODE
super.processMouseEvent( event );
}
----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


The new code do not give any compilation error. But when I start the
Applet the mousedown is not working.

Q 1. Do I have to add something more to use mouse pressed events?

Q 2. What is the benefit of using processMouseEvent() instead of
mousedown()?

Bye
Sanny




From: Andrew Thompson on
On Jul 15, 3:36 pm, Sanny <softta...(a)hotmail.com> wrote:
...
> The new code do not give any compilation error. But when I start the
> Applet the mousedown is not working.

Maybe it is just tired. Give it a good night's
rest and call me in the morning.

> Q 1. Do I have to add something more to use mouse pressed events?

That depends (on the code not shown).

An SSCCE helps to explain code very well.
<http://pscode.org/sscce.html>

Please be specific*, and try to frame a 'smart question'**.

* <http://pscode.org/javafaq.html#specific>
** See link from that section of the document

> Q 2. What is the benefit of using processMouseEvent() instead of
> mousedown()?

It is not deprecated.

--
Andrew Thompson
http://pscode.org/
From: Sanny on

> > Q 1. Do I have to add something more to use mouse pressed events?

Yes I found out Event Masks are needed. And it worked.

Bye
Sanny



From: Joshua Cranmer on
Sanny wrote:
> I was using mousedown() As Below.
>
> ----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> public boolean mouseDown(Event evt, int x,int y){
>
> ----- OLD CODE
> ----- OLD CODE
> return true;
> }
> ----------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
>
> Above code works correctly. Now I found somewhere mousedown is
> depriciated. And I thought of changingf to

Event handling between the early versions of Java and modern versions
changed, drastically. With something this big, I'd recommend reading the
Java Tutorial on GUIs again.

What you want to be using now is the event handling mechanisms using
MouseListener and friends.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth