Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get mouse position in java without frames or applet

Posted on 2004-04-07
12
Medium Priority
?
1,312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

730 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