StreamDeck4J
Java library for the StreamDeckSDK
Install / Use
/learn @WalshyDev/StreamDeck4JREADME
StreamDeck4J
The StreamDeck library for Java!
Usage
Create an instance of StreamDeck, add any listeners you may want (You can either use EventListener or the more preferred ListenerAdapter for this). Finally, just call connect()!
Example code
For a full example check our the src/main/test/java/Example class.
public static void main(String[] args) {
StreamDeck4J streamDeck4J = new StreamDeck4J();
streamDeck4J.addListener(new AbstractListener() {
@Override
public void onActionAppeared(ActionAppearedEvent event) {
streamDeck4J.setTitle(
event.getContext(),
"Made With\nStreamDeck4J!",
Destination.HARDWARE_AND_SOFTWARE
);
}
});
streamDeck4J.connect(args);
}
Building for the StreamDeck
- Compile your jar with your build tool
- Use Launch4J (http://launch4j.sourceforge.net) to make it an exe
- Put the exe in your
manifest.jsonas theCodePath - Profit!
How to add?
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.WalshyDev</groupId>
<artifactId>StreamDeck4J</artifactId>
<version>1.1</version>
</dependency>
Gradle
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.WalshyDev:StreamDeck4J:1.1'
}
Logging Framework - SLF4J
SD4J uses SLF4J to log its messages.
That means you should add some SLF4J implementation to your build path in addition to SD4J. If no implementation is found, following message will be printed to the console on startup:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
The most popular implementations are Log4j 2 and Logback. Here's a nice example of a logback.xml
<!-- TODO: Implement fallback logger -->