Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.jjfiv:gfx:1.7.0'
}
dependencies {
implementation("com.github.jjfiv:gfx:1.7.0")
}
<dependency>
<groupId>com.github.jjfiv</groupId>
<artifactId>gfx</artifactId>
<version>1.7.0</version>
</dependency>
libraryDependencies += "com.github.jjfiv" % "gfx" % "1.7.0"
:dependencies [[com.github.jjfiv/gfx "1.7.0"]]
GFX library to simplify Graphics2D access to just using inheritance. If you just want to put some graphics on screen and don't want to learn about the Swing threading model, this is your friend.
Getting a drawable canvas in Swing can require many steps, and event handlers and the EventQueue thread are full of traps for newcomers. This library simplifies all that:
import java.awt.Color;
import java.awt.Graphics2D;
import me.jjfoley.gfx.GFX;
public class MyDrawing extends GFX {
// Draw is called 60 times per second.
@Override
public void draw(Graphics2D g) {
g.setColor(Color.red);
g.fillRect(0, 0, 200, 200);
}
// Running with graphics is as simple as calling ``start`` on your class.
public static void main(String[] args) {
MyDrawing app = new MyDrawing();
app.start();
}
}
This repository can be used via jitpack.io. First, add the repository:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Next, add this repo:
<dependency>
<groupId>com.github.jjfiv</groupId>
<artifactId>GFX</artifactId>
<version>1.7.0</version>
</dependency>