Skip to content
/ GFX Public

GFX library to simplify Graphics2D access.

Notifications You must be signed in to change notification settings

jjfiv/GFX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GFX Build Status Jitpack.io Badge

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.

JavaDoc

Motivation

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();
	}
}

Use from Maven

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>