AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Negative MouseEvent

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Grethe
Guest





PostPosted: Thu Feb 16, 2006 1:12 pm    Post subject: Negative MouseEvent Reply with quote



Hi

I'm having a bit of trouble understanding MouseEvent. For some reason I'm
able to make it return a negative point on mousePressed when printing out
getPoint. How is this possible? I dont see how it is possible to trigger a
MouseEvent on a component that has a MouseListener without the clicking
point being inside the component. Im using java 1.1.8(Don't ask why). Is
this a bug in Java 1.1?

java.awt.Point[x=-17,y=38]

Mike
Back to top
Rhino
Guest





PostPosted: Thu Feb 16, 2006 3:12 pm    Post subject: Re: Negative MouseEvent Reply with quote



"Grethe" <no (AT) spam (DOT) com> wrote in message
news:43f475ed$0$6849$d40e179e (AT) nntp02 (DOT) dk.telia.net...
Quote:
Hi

I'm having a bit of trouble understanding MouseEvent. For some reason I'm
able to make it return a negative point on mousePressed when printing out
getPoint. How is this possible? I dont see how it is possible to trigger a
MouseEvent on a component that has a MouseListener without the clicking
point being inside the component. Im using java 1.1.8(Don't ask why). Is
this a bug in Java 1.1?

java.awt.Point[x=-17,y=38]

The coordinate system is based on the default origin, (0,0), being in the

upper left corner. That results in both the X and Y coordinates of any point
being positive since every point south or east of the origin has a higher X
or Y coordinate than zero.

But there is a method, translate(), that can change the origin to some other
point. Is it possible that your code does a translate()? That could explain
your results.

--
Rhino
Back to top
Mike
Guest





PostPosted: Thu Feb 16, 2006 3:12 pm    Post subject: Re: Negative MouseEvent Reply with quote



Quote:
But there is a method, translate(), that can change the origin to some
other point. Is it possible that your code does a translate()? That could
explain your results.

My code does not use translate at any point. If translate is used it is done
within AWT. But the thing is that im not doing anything to change the
result. It's the point directly from the event thats negative. I strongly
suspect its a bug since java 1.1 is very buggy. Its no problem fixing it. I
just make sure to check for negative values. But since in my mind it
shouldnt be possible to get a negative value from mousePressed i think its a
bug.

Mike
Back to top
Monique Y. Mudama
Guest





PostPosted: Thu Feb 16, 2006 6:12 pm    Post subject: Re: Negative MouseEvent Reply with quote

On 2006-02-16, Mike penned:
Quote:
But there is a method, translate(), that can change the origin to
some other point. Is it possible that your code does a translate()?
That could explain your results.

My code does not use translate at any point. If translate is used it
is done within AWT. But the thing is that im not doing anything to
change the result. It's the point directly from the event thats
negative. I strongly suspect its a bug since java 1.1 is very buggy.
Its no problem fixing it. I just make sure to check for negative
values. But since in my mind it shouldnt be possible to get a
negative value from mousePressed i think its a bug.

Having to use 1.1 is like having to code with your hands tied behind
your back.

--
monique

Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Back to top
Roedy Green
Guest





PostPosted: Fri Feb 17, 2006 5:12 am    Post subject: Re: Negative MouseEvent Reply with quote

On Thu, 16 Feb 2006 09:15:48 -0500, "Rhino"
<no.offline.contact.please (AT) nospam (DOT) com> wrote, quoted or indirectly
quoted someone who said :

Quote:
The coordinate system is based on the default origin, (0,0), being in the
upper left corner. That results in both the X and Y coordinates of any point
being positive since every point south or east of the origin has a higher X
or Y coordinate than zero.
see http://mindprod.com/jgloss/coordinates.html

for a pictorial explanation
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Mike
Guest





PostPosted: Fri Feb 17, 2006 12:12 pm    Post subject: Re: Negative MouseEvent Reply with quote

Quote:
Having to use 1.1 is like having to code with your hands tied behind
your back.

agreed. however i have no choice since its my job:\

Mike
Back to top
Mike
Guest





PostPosted: Fri Feb 17, 2006 12:12 pm    Post subject: Re: Negative MouseEvent Reply with quote

Quote:
see http://mindprod.com/jgloss/coordinates.html
for a pictorial explanation

The problem is not wether i understand how coordinates work i java. The
question is: is it possible to get a negative point when mousePressed is
called or is this a bug in java 1.1?
Back to top
Roedy Green
Guest





PostPosted: Sat Feb 18, 2006 1:12 am    Post subject: Re: Negative MouseEvent Reply with quote

On Fri, 17 Feb 2006 12:27:51 +0100, "Mike" <no (AT) spam (DOT) com> wrote, quoted
or indirectly quoted someone who said :

Quote:
The problem is not wether i understand how coordinates work i java. The
question is: is it possible to get a negative point when mousePressed is
called or is this a bug in java 1.1?

A could see a negative point occurring like this. A mouse click comes
in. Through magical processes it arrives at the Container. The
container looks at the bounds of all its contents and picks the one
containing the point. If it can't find one it has to deal with it
itself. It then selects triggers the event handler of the content
component with the x,y adjusted to be relative to the component.

What could happen to screw this up?

Mainly a second thread meddling, say moving or resizing components
while the container was in the process of dispatching the event.

--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Back to top
Mike
Guest





PostPosted: Sat Feb 18, 2006 11:12 am    Post subject: Re: Negative MouseEvent Reply with quote

Quote:
A could see a negative point occurring like this. A mouse click comes
in. Through magical processes it arrives at the Container. The
container looks at the bounds of all its contents and picks the one
containing the point. If it can't find one it has to deal with it
itself. It then selects triggers the event handler of the content
component with the x,y adjusted to be relative to the component.

What could happen to screw this up?

Mainly a second thread meddling, say moving or resizing components
while the container was in the process of dispatching the event.

Interesting point. Actually it occurs while moving(animating) an object. So
basically its a synchronization issue?
Im still a bit puzzled about how it can occur. I would like java to be able
to handle this synchronization issue. But am i wrong in assuming that?

Mike.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.