Jazz

An easy drawing library for Java using Swing for drawing (therefor Jazz).

License

License

GroupId

GroupId

de.scravy
ArtifactId

ArtifactId

jazz
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Jazz
An easy drawing library for Java using Swing for drawing (therefor Jazz).
Source Code Management

Source Code Management

https://github.com/scravy/Jazz

Download jazz

How to add to project

<!-- https://jarcasting.com/artifacts/de.scravy/jazz/ -->
<dependency>
    <groupId>de.scravy</groupId>
    <artifactId>jazz</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/de.scravy/jazz/
implementation 'de.scravy:jazz:1.1.0'
// https://jarcasting.com/artifacts/de.scravy/jazz/
implementation ("de.scravy:jazz:1.1.0")
'de.scravy:jazz:jar:1.1.0'
<dependency org="de.scravy" name="jazz" rev="1.1.0">
  <artifact name="jazz" type="jar" />
</dependency>
@Grapes(
@Grab(group='de.scravy', module='jazz', version='1.1.0')
)
libraryDependencies += "de.scravy" % "jazz" % "1.1.0"
[de.scravy/jazz "1.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
junit : junit jar 4.12
de.scravy : pair jar 1.1.0
org.slf4j : slf4j-api jar 1.7.12

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.4

test (1)

Group / Artifact Type Version
org.slf4j : slf4j-simple jar 1.7.12

Project Modules

There are no modules declared in this project.

Jazz

Jazz is a tiny drawing library for Java 7+. It is based on Java 2D and tries to offer a simplistic API. Have a look at the Examples.

It is primarily aimed at beginner Java programmers.

Concepts

Jazz offers various levels of control:

  • Pictures (static drawings)
  • Animations
  • Worlds (animations with event handling)

Pictures are drawings that do not change over time. Jazz automatically aids in support for zooming and moving the canvas.

Animations are pictures which change over time. Jazz automatically aids in support for increasing and decreasing the animation speed.

Worlds are suitable for implementing simple games. They are capable of handling input events of any kind.

Here is how you fire up a simple Jazz window that displays a circle with a radius of 20 pixel:

public static void main(String... args) {
    Jazz.display("Hello Circle", 200, 200, new Circle(20.0));
}

Jazz uses a coordinate system like you use in mathematics, i.e. (0,0) is in the center of the window and the x and y axis grow towards the top and to the left:

               (+)
              y ^
                |
                |
                |
(-) ------------+------------> x (+)
                |
                |
                |
               (-)

That is, the above code will display a circle with a diameter of 40 pixels in the center of the window. If you want to move an object, you can apply a translation:

new Circle(20).translate(100, 100);

This will display the same circle in the upper right of the window.

An Animation can be created by extending the Animation class:

Jazz.animate("Moving circle", 600, 400, new Animation() {
    double posX = 0;

    public void update(double time, double delta) {
        posX = Math.sin(time) * 100;
    }

    public Picture getPicture() {
        return new Circle(20).translate(posX, 0);
    }
});

This will display a circle oscillating between (-100,0) and (100,0).

Javadoc

To build the javadoc, download or clone the repository and run

mvn javadoc

in the Jazz project directory.

Roadmap

  • More examples
  • Full Javadoc documentation
  • Upload to Maven Central

This document: 2014-01-13

Versions

Version
1.1.0
1.0.0