Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shanescarlett/jstick
The simple joystick component for Java Swing
https://github.com/shanescarlett/jstick
java joystick swing
Last synced: 15 days ago
JSON representation
The simple joystick component for Java Swing
- Host: GitHub
- URL: https://github.com/shanescarlett/jstick
- Owner: shanescarlett
- License: apache-2.0
- Created: 2021-10-05T00:30:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-12T04:10:46.000Z (over 3 years ago)
- Last Synced: 2023-12-08T17:13:38.664Z (about 1 year ago)
- Topics: java, joystick, swing
- Language: Java
- Homepage:
- Size: 240 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JStick
JStick, the simple joystick for Java Swing.
## Getting Started
### Prerequisites
JStick is compatible with Java language level 8 or newer.
### Installation
Add JStick to your Maven project by adding the following dependency to ```pom.xml```:
```xmlnet.scarlettsystems.java
jstick
0.0.2```
## Usage
The component may be instantiated by simply calling its constructor:
```java
JStick myJoystick = new JStick();
```
Adding the component to a panel will automatically have the joystick sized to fill its bounds:
```java
JPanel panel = new JPanel();
panel.add(myJoystick);
```
Attach a listener to be fired each time motion is detected on the joystick:
```java
myJoystick.addJoystickListener(new JStick.JoystickListener()
{
@Override
public void onJoystickMoved(JStick j)
{
int x = j.getStickX();
int y = j.getStickY();
//Do something useful
}@Override
public void onJoystickClicked(JStick j)
{}
});
```
There are several other configurable parameters including the colour and dead-zone. See the docs for more information.## Version
The most current stable version is ```0.0.2```## Authors
* **Shane Scarlett** - *core development* - [Scarlett Systems](https://scarlettsystems.net)
## Acknowledgements
This component was inspired by Sam Arthur Gilliam's Stackoverflow answer [here](https://stackoverflow.com/questions/16439621/java-on-screen-virtual-joystick-control), and contains heavily modified code from said post.## License
This project is licensed under the Apache 2.0 License.