Hi,
> Hi,
> Someone that can figure out a smart way to invert my mousepointer's
[quoted text clipped - 6 lines]
> but I want mouseXpos to be inverted... i.e 800 should be 1 and 1 should
> be 800 (if my screen resolution is 800..)
I'm not sure if I understand your problem correctly, because if I do
understand you correctly, the problem would be trivial and I would
suggest you give up programming when you do not get the solution by
yourself:
doMyFancyStuff(800-mouseXpos+1,mouseYpos);
Or do you want to know how to get the screen-resolution? That should be
something like:
Toolkit.getDefaultToolkit().getScreenResolution();
BTW: Computers start counting with 0, so you have an off-by-1-error.
Ciao,
Ingo
jmcgill - 22 May 2006 19:06 GMT
> doMyFancyStuff(800-mouseXpos+1,mouseYpos);
Now THAT is a bad idea, putting a magic number in there, where it only
works in one specific case.
This is a job for Graphics2D.transform(). Don't compute the
coordinates, change the origin.
Ingo R. Homann - 23 May 2006 09:59 GMT
Hi,
>> doMyFancyStuff(800-mouseXpos+1,mouseYpos);
>
> Now THAT is a bad idea, putting a magic number in there, where it only
> works in one specific case.
I know that. That's why I wrote the rest of my posting (that you snipped).
> [snipped another good idea ;-]
Ciao,
Ingo
> Hi,
> Someone that can figure out a smart way to invert my mousepointer's
[quoted text clipped - 6 lines]
> but I want mouseXpos to be inverted... i.e 800 should be 1 and 1 should
> be 800 (if my screen resolution is 800..)
I don't see how a "screen resolution" might come in here. You probably mean
"screen width" (in dots), not "screen resolution" (in dots per inch).
BTW: You can get it with Toolkit.getDefaultToolkit().getScreenSize().width

Signature
Thomas
Oliver Wong - 25 May 2006 16:51 GMT
>> Hi,
>> Someone that can figure out a smart way to invert my mousepointer's
[quoted text clipped - 11 lines]
> "screen width" (in dots), not "screen resolution" (in dots per inch).
> BTW: You can get it with Toolkit.getDefaultToolkit().getScreenSize().width
I don't know about the etymological correctness of the term, but
nowadays "screen resolution" often refers to the number of pixels a screen
can display. See, for example,
http://en.wikipedia.org/wiki/Screen_resolution
- Oliver