public class SGKeyListener
extends java.lang.Object
implements java.awt.event.KeyListener, java.lang.Iterable<java.awt.event.KeyEvent>, java.util.Iterator<java.awt.event.KeyEvent>
Modifier and Type | Class and Description |
---|---|
static class |
SGKeyListener.CaptureType
Indicates when the capture should occur.
|
Constructor and Description |
---|
SGKeyListener(boolean blockOnEmpty,
SGKeyListener.CaptureType type)
Creates a new listener which can optionally block when no input is
currently available and will capture on key up or key down depending on
the parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
flush()
Empties the backing queue of data.
|
boolean |
hasNext() |
java.util.Iterator<java.awt.event.KeyEvent> |
iterator() |
void |
keyPressed(java.awt.event.KeyEvent e) |
void |
keyReleased(java.awt.event.KeyEvent e) |
void |
keyTyped(java.awt.event.KeyEvent e) |
java.awt.event.KeyEvent |
next()
Consumes the KeyEvent that is returned as it is returned.
|
void |
remove()
The remove operation is not supported by this class.
|
public SGKeyListener(boolean blockOnEmpty, SGKeyListener.CaptureType type)
blockOnEmpty
- if true then this object will wait until there is
input before returning from a request for the next eventcaptureOnKeyDown
- if true then will capture events immediately upon
the key being pressed, if false then the key must be released before the
event is capturedpublic void flush()
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public boolean hasNext()
hasNext
in interface java.util.Iterator<java.awt.event.KeyEvent>
public java.util.Iterator<java.awt.event.KeyEvent> iterator()
iterator
in interface java.lang.Iterable<java.awt.event.KeyEvent>
public java.awt.event.KeyEvent next()
next
in interface java.util.Iterator<java.awt.event.KeyEvent>
public void remove()
remove
in interface java.util.Iterator<java.awt.event.KeyEvent>