Questions tagged [awtrobot]

The Robot class (java.awt.Robot) is used to programmatically trigger input events such as key press events and mouse actions & can also perform screenshot capture.

The Robot class (java.awt.Robot) is used to programmatically trigger input events, such as key press events and mouse actions & can also perform capture.

For Example:

Example of Java Robot Programming

662 questions
0
votes
1 answer

getting a list of running applications with java and then sending a key press to it

can java even do this? i know it is suppose to be "sandboxed" but what i'm looking to do is this: open my java program have a combo box full of running programs (runtime exec?) after i've selected the program thats running, i then want to send that…
genx1mx6
  • 425
  • 1
  • 6
  • 12
0
votes
1 answer

How to let the user and the computer take turns to click?

This is the test file. while(count<52){ System.out.println("the times:"+panel.getCount()); if(panel.getCount()==3){ for(int i=0;i<2;i++){ try{ int temp=number.nextInt(51); panel.simulationClick(temp); } …
Yuhan Su
  • 59
  • 5
0
votes
0 answers

Java Applet/Robot Keycode Mismatch

I am feeding the key from KeyUp()/KeyDown() in an applet to a Robot's KeyPress()/keyRelease() through UDP to "synchronize" the inputs of two users. However, the key codes appear to be mismatched - A "k" on the client end produces a "+" on the server…
0
votes
3 answers

Java - KeyEvent variable

So. I got a little problem. Most likey caused because Im very new to java. Anyways, my question is: Why does this not work? public static void pressKey(KeyEvent key) throws AWTException { Robot r = new Robot(); r.keyPress(KeyEvent.key); …
0
votes
1 answer

How to capture screen shots of various operating systems in java?

I am working on Java project. I need to capture screens shots of different operating systems. String outFileName = "c:\\Windows\\Temp\\screen.jpg"; try{ long time = Long.parseLong(secs) * 1000L; System.out.println("Waiting " + (time /…
user1448108
  • 467
  • 2
  • 10
  • 28
0
votes
0 answers

Keylogging in Java for Mac OSX

I need a program/library to record all keystrokes (Java preferred). I disassembled a normal keyboard to build a custom interface for certain programs. An interface which provides a physical interface for certain shortcuts. As I need to remap…
Pwdr
  • 3,712
  • 4
  • 28
  • 38
0
votes
0 answers

KeyEvent not being sent to the expected Component after a requestFocusInWindow

I use a java.util.Robot to send key events to some components of my Swing App. I've got the following issue: to send an event to an unfocused component, I call requestFocusInWindow (from the AWT thread to have the type-ahead garanty as indicated in…
0
votes
0 answers

Turn Char into KeyEvent

I am making a little program for educational reasons (Have no practical usage really :P). What I am trying to accomplish, is feeding a Text to a Robot and then make it open up Notepad and type out the text using KeyPress and KeyRelease. I know…
OmniOwl
  • 5,477
  • 17
  • 67
  • 116
0
votes
1 answer

java search image on Screen

Is there a fast way to find an Image on the Screen? I did like that: (before that i captured the screen with Robot.createScreenCapture(...)) public static Point search(BufferedImage big, BufferedImage small) { Robot robot = null; try { …
TeNNoX
  • 1,899
  • 3
  • 16
  • 27
0
votes
1 answer

Write to keyboard buffer, for use outside of own application

I'm writing on an application that gets signals of the Apple Remote and I'm already finished reading the hardware inputs on the remote. Now i have to replicate these inputs on the remote on something like an keyboard buffer or whatever there exists.…
AirUp
  • 426
  • 1
  • 8
  • 18
0
votes
2 answers

Robot class, move the mouse in a circular motion

What I want to do is make my mouse move in a circular fashion around a point (500px away from said point). I want the mouse to do this anticlockwise. So what I am trying to say is this.. I want the mouse to move around a point 500px away, using the…
Duncan Palmer
  • 2,865
  • 11
  • 63
  • 91
0
votes
0 answers

Overlay on top of browser using Java Robots

I have some browser flash game. In this game there are some players/objects, and I can steer one of them. I want to write bot for this game. Bot will 'read' the state of game (capturing the part of the screen and finding the positions of players),…
Adi
  • 2,011
  • 2
  • 15
  • 14
0
votes
3 answers

Java Robot - Class functions issue

I am trying to make a separate class for the Java AWT Robot to use with projects but i am having trouble setting it up how i would like as all of the examples I have found online seem to pack the code into a single .java file instead. My code works…
zeddex
  • 1,260
  • 5
  • 21
  • 38
0
votes
0 answers

Differentiate between keyboard/mouse events and Java Robot events

In Java, you can listen for key/mouse events generated by the user keyboard/mouse. Also, Java allows you to generate key/mouse events using the java.awt.Robot, and these events can be captured by the same listeners. How can you differentiate between…
ccit
  • 309
  • 1
  • 3
  • 12
0
votes
2 answers

Computer reboots when start Processing application

My problem is that when I run the following code in Processing my PC restarts.. import java.awt.AWTException; import java.awt.Robot; Robot robot; void setup() { size(400, 400); try { robot = new Robot(); } catch (AWTException e) { …
acidghost
  • 484
  • 4
  • 14