Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sinister Zeta Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sinister Zeta
Sinister Zeta Project
Merge requests
!34
Test gitignore
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Test gitignore
test-gitignore
into
master
Overview
0
Commits
9
Pipelines
0
Changes
1
Closed
Nikola Babic (nab701)
requested to merge
test-gitignore
into
master
4 years ago
Overview
0
Commits
9
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
5f5c5a1e
Prev
Next
Show latest version
1 file
+
13
−
17
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
5f5c5a1e
Updated action class
· 5f5c5a1e
Dallin Nickel (djn011)
authored
4 years ago
src/model/Action.java
+
13
−
17
Options
@@ -4,33 +4,29 @@ import java.awt.*;
import
java.awt.event.KeyEvent
;
import
javax.swing.JFrame
;
public
class
Action
extends
Hotkey
{
public
class
Action
implements
InputEmulator
{
/**
* Robot
which
simulate
s user key
presses
* Robot
to
simulate
button
presses
*/
Robot
robot
;
/**
* Constructs an immutable hotkey.
*
* @param keyCode The virtual keycode of the hotkey.
* @param id The unique ID of the hotkey.
* @param modifier The modifier of the hotkey.
* Constructor to create a new robot to control key presses
* @throws AWTException
*/
public
Action
(
int
keyCode
,
int
id
,
Modifier
modifier
)
throws
AWTException
{
super
(
keyCode
,
id
,
modifier
);
public
Action
()
throws
AWTException
{
this
.
robot
=
new
Robot
();
}
/**
* Simulates the pressing of the buttons specified by modifier and keycode
* Sends a given key to be emulated.
* @param keyCode The virtual keycode of the key.
* @param release True if the key is to be a key release input.
*/
public
void
press
(){
robot
.
keyPress
(
this
.
getModifier
().
val
());
robot
.
keyPress
(
this
.
getKeyCode
());
robot
.
keyRelease
(
this
.
getModifier
().
val
());
robot
.
keyRelease
(
this
.
getKeyCode
());
@Override
public
void
sendKey
(
int
keyCode
,
boolean
release
)
{
robot
.
keyPress
(
keyCode
);
robot
.
keyRelease
(
keyCode
);
}
}
Loading