|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.uicapture.v1.VirtualWindow
A window which covers the whole screen, and does not paint in the background. It captures keyboard and mouse events, and sends them to both all registered listeners, and to the underlying GUI as well. This transparent window is similar to the "glass pane" concept in Swing JFrames.
For the moment, there is no way for listeners to prevent an event from being passed to the underlying UI. This needs to be changed.
WARNING: if the screen size is to resize, then this will not work correctly.
Constructor Summary | |
VirtualWindow()
Create a new VirtualWindow, with the glass enabled. |
|
VirtualWindow(java.lang.String title,
boolean enable)
Specify the initial enabled state of the window. |
Method Summary | |
void |
addCaptureListener(ICaptureListener cl)
Adds an ICaptureListener to the list of recipients of input events. |
java.awt.image.BufferedImage |
createScreenScrape()
Scrapes the current screen into a BufferedImage the same size as the window. |
java.awt.image.BufferedImage |
createScreenScrape(java.awt.Rectangle bounds)
Scrapes the current screen into a BufferedImage from the given area on the screen. |
void |
delay(int ms)
Sleeps for the specified number of milliseconds. |
void |
dispose()
Close out all inner instances and shut down the UI |
protected java.util.Iterator |
getCaptureListeners()
Returns a list of all the current ICaptureListeners. |
VirtualWindowUI |
getWindow()
|
void |
hide()
Hides the glass pane, and stops all input event capturing. |
boolean |
isGlassEnabled()
Retrieves the current glass enabled state. |
void |
keyPressed(java.awt.event.KeyEvent ke)
|
void |
keyReleased(java.awt.event.KeyEvent ke)
|
void |
keyTyped(java.awt.event.KeyEvent me)
|
void |
mouseClicked(java.awt.event.MouseEvent me)
|
void |
mouseDragged(java.awt.event.MouseEvent me)
|
void |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mouseMoved(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent me)
|
void |
removeCaptureListener(ICaptureListener cl)
Removes the given ICaptureListener from the inner list of input events recipients. |
void |
setGlassEnabled(boolean on)
Sets the inner state for displaying the glass pane. |
void |
show()
Shows the glass pane, and continues all input event capturing. |
void |
simulateEvent(CaptureEvent ce)
Simulates the given captured event. |
void |
update()
Updates the background image. |
void |
waitForIdle()
Waits until all events currently on the event queue have been processed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public VirtualWindow() throws java.awt.AWTException
java.awt.AWTException
- thrown if a Robot is not supported
in the current JDK implementation.public VirtualWindow(java.lang.String title, boolean enable) throws java.awt.AWTException
enable
- set to the initial glass pane state.
java.awt.AWTException
- thrown if a Robot is not supported
in the current JDK implementation.Method Detail |
public void dispose()
public VirtualWindowUI getWindow()
public void setGlassEnabled(boolean on)
on
- true if the glass pane is enabled (active and
intercepting events), or false if is disabled.public boolean isGlassEnabled()
public void simulateEvent(CaptureEvent ce)
ce
- the event to simulate.public void delay(int ms)
ms
- Time to sleep in milliseconds.
java.lang.IllegalArgumentException
- thrown by Robot if ms is
not between 0 and 60,000, inclusive.public void waitForIdle()
public java.awt.image.BufferedImage createScreenScrape()
public java.awt.image.BufferedImage createScreenScrape(java.awt.Rectangle bounds)
public void addCaptureListener(ICaptureListener cl)
cl
- the listener to add.public void removeCaptureListener(ICaptureListener cl)
cl
- the listener to remove.public void hide()
public void show()
public void update()
public void mouseWheelMoved(java.awt.event.MouseWheelEvent me)
mouseWheelMoved
in interface java.awt.event.MouseWheelListener
MouseWheelListener
public void mouseDragged(java.awt.event.MouseEvent me)
mouseDragged
in interface java.awt.event.MouseMotionListener
MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved
in interface java.awt.event.MouseMotionListener
MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent me)
mousePressed
in interface java.awt.event.MouseListener
MouseListener
public void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased
in interface java.awt.event.MouseListener
MouseListener
public void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked
in interface java.awt.event.MouseListener
MouseListener
public void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered
in interface java.awt.event.MouseListener
MouseListener
public void mouseExited(java.awt.event.MouseEvent me)
mouseExited
in interface java.awt.event.MouseListener
MouseListener
public void keyTyped(java.awt.event.KeyEvent me)
keyTyped
in interface java.awt.event.KeyListener
KeyListener
public void keyPressed(java.awt.event.KeyEvent ke)
keyPressed
in interface java.awt.event.KeyListener
KeyListener
public void keyReleased(java.awt.event.KeyEvent ke)
keyReleased
in interface java.awt.event.KeyListener
KeyListener
protected java.util.Iterator getCaptureListeners()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |