Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

get mouse position in java without frames or applet

Posted on 2004-04-07
12
Medium Priority
?
1,317 Views
Last Modified: 2012-08-13
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
0
Comment
Question by:Traltixx
  • 4
  • 3
  • 2
  • +1
12 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10781065
i don't think you can (without native code).
0
 
LVL 2

Author Comment

by:Traltixx
ID: 10781087
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
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 10781141
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 92

Expert Comment

by:objects
ID: 10781148
> what do you mean by native code?

I mean you'll need to write code specific to the OS you are running on
0
 
LVL 2

Author Comment

by:Traltixx
ID: 10781184
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 10781206
Pretty sure u are going to need to write native code for whatever OS you want to support.
0
 
LVL 2

Author Comment

by:Traltixx
ID: 10781211
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?
0
 
LVL 92

Accepted Solution

by:
objects earned 160 total points
ID: 10781238
for example for Windows you woould need to write a dll.
0
 
LVL 13

Assisted Solution

by:Webstorm
Webstorm earned 160 total points
ID: 10782102
0
 
LVL 14

Assisted Solution

by:Tommy Braas
Tommy Braas earned 160 total points
ID: 10788835
Traltixx, native code is anything that is not interpreted, e.g. C/C++ etc. It runs unmodified on the processor, the binary executable files contain processor instructions for a specific processor (processor family). For instance, native code compiled for Mac OS X/PowerPC will not run on Windows/Pentium. Instruction sets differ between processor families and are incompatible.

Java is interpreted and requires a Java Runtime for the platform on which the code is to run. Java binary code (.class files) contain processor instructions for the Java processor, which until a few years ago was a virtual processor (it didn't exist in real life). You can now buy and equip a computer with a Java processor. There is even a Java OS.

JNI bridges the gap between Java and native code. When running the javah compiler a C file is created. It is this C file you add your own platform specific code by calling into various APIs available for that platform. In your case you need to find which APIs to interface with in order to accomplish your task.

Good Luck!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
This video teaches viewers about errors in exception handling.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question