Link to home
Start Free TrialLog in
Avatar of Traltixx
Traltixx

asked on

get mouse position in java without frames or applet

hi,
just a quick question. if for example i move a mouse to a certain position using ajav.awt.Robot.
can i get the mouse position? without using frames or applets? so just the mouse coordinates of the current screen. is it possible? or must i use a frame or applet for it?
thanks
Avatar of Mick Barry
Mick Barry
Flag of Australia image

i don't think you can (without native code).
Avatar of Traltixx
Traltixx

ASKER

cant? what do you mean by native code?
are there other languages where i can emulate mouse movement (keystrokes) and get their values/position? if there are where can i find information on it?
thanks
If you're controlling the position of the mouse pointer, why would you need to read it? To validate that the mouse pointer actuallyu moved?

For all types of UI events in a modern OS are basically divided up into two categories; System events and application events.

System events become application events when the system has determined which application the events belong to.

java.awt.Robot, I believe, can only be used inside a Java GUI. I guess that's the whole idea with it.
> what do you mean by native code?

I mean you'll need to write code specific to the OS you are running on
moving and reading the mouse pointer are done in seperate classes. use in different times, but i need both.
anyway, the java.awt.Robot can be used outside the java GUI even into external applications. but i need to get the mouse position in those external applications.
Pretty sure u are going to need to write native code for whatever OS you want to support.
ok..i still dont get what you mean by native code? some sort of assembly like code which can interact with the OS? arent there other languages i can use to acomplish this?
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial