public interface Input
getEvent()
function
removes a single event from the queue. If the queue is empty,
the program blocks until an event is raised.
The table below shows all possible events:
Name | Description | Data |
mouseover | This event is generated when the mouse enters an object. |
In the SnakeUserInterface and OthelloUserInterface
The coordinate of the cell on which the mouse is located. For example "4 3" Note: The OthelloUserInterface has
cells starting at 1, instead of 0.
In the DrawUserInterface The name of the hotspot, which the mouse enters. |
mouseexit | Only in DiagramTekenUserInterface When the mouse leaves a hotspot. | The name of the hotspot, which the mouse leaves. |
click | When the user clicks on an object |
In the SnakeUserInterface and OthelloUserInterface
The coordinate of the cell on which the mouse is located. For example "4 3" Note: The OthelloUserInterface has
cells starting at 1, instead of 0.
In the DrawUserInterface The name of the hotspot on which the user clicked. |
Name | Description | Data |
alarm |
When an alarm is generated by the AlarmSystem via the method AlarmSystem.setAlarm(String, int, boolean) .
|
The name of the alarm, i.e. the string provided when calling
AlarmSystem.setAlarm(String, int, boolean) .
When the alarm is raised to signal a screen refresh, i.e. generated by AnimationEventSystem.setFramesPerSecond(double) ,
the data will be "refresh".
|
Name | Description | Data |
arrow | One of the arrow keys is pressed. | "L" for left, "R" for right, "U" for up, "D" for down. |
number | One of the number keys is being pressed | The number that is being pressed. |
alt_number | One of the number keys is being pressed, whilst the alt key is also being pressed. | The number that is being pressed. |
letter | A letter is being pressed. | The letter, or capital letter, if shift or caps-lock are enabled. |
other_key | A key is being pressed, which is not a number, letter or arrow, | A string describing the key, for example: "Slash", "Ctrl" |
Modifier and Type | Method and Description |
---|---|
void |
enableEventProcessing(boolean on)
This method can enable or disable the reception of events.
|
Event |
getEvent()
This function blocks until an event occurs and returns
an
Event object with the name and the data of the
event that occurred. |
Event getEvent()
Event
object with the name and the data of the
event that occurred.
For example, pressing the letter a will result in an event with
the name "leter" and data "a".void enableEventProcessing(boolean on)
on
- If true, events are received, if false, events are ignored.