Code Monkey home page Code Monkey logo

kanvas's Introduction

JKanvas

An easy-to-use ZUI (Zoomable User Interface) implementation for Java.

This project is build with Maven. Use mvn install to generate it as a jar in the target/ directory. Alternatively the project can be used as dependency in other Maven projects (see [below] (#maven-integration)).

In order to create a ZUI component you can use the following snippet:

Renderpass renderpass = new Renderpass() {

  @Override
  public void draw(final Graphics2D g, final KanvasContext ctx) {
    // draw here
    // ctx can be used to convert between canvas and component coordinates
  }

  @Override
  public boolean click(final Camera cam, final Point2D p, final MouseEvent e) {
    // react to events
  }

  @Override
  public void getBoundingBox(final RectangularShape rectangularShape) {
    // set bounding box for the render pass
  }

};
RenderpassPainter painter = new RenderpassPainter();
painter.addPass(renderpass);
Canvas canvas = new Canvas(painter, width, height);
// ...
parent.add(canvas); // adds the canvas to the parent component
canvas.reset(); // scrolls the bounding-box of the painter into view

In the package jkanvas.examples are examples that show how to use the canvas for various tasks. Furthermore the [wiki] (https://github.com/JosuaKrause/Kanvas/wiki) is meant to explain how to use various classes and interfaces.

Maven Integration

In order to use JKanvas within a Maven project you can use the following dependency (in the <dependencies> section -- note that the X.X.X in the version tag must be replaced with the current version):

<dependency>
  <groupId>joschi-mvn</groupId>
  <artifactId>JKanvas</artifactId>
  <version>X.X.X</version>
</dependency>

However, this requires an additional repository in the repositories section (<repositories>) of the pom.xml file:

<repository>
  <id>joschi</id>
  <url>http://merkur57.inf.uni-konstanz.de/~krause/mvn/releases</url>
</repository>

When using [Eclipse] (http://www.eclipse.org/) the current snapshot can be used by having the JKanvas project open and altering the version of the dependency to X.X.X-SNAPSHOT where X.X.X is the upcoming version.

kanvas's People

Contributors

enplotz avatar josuakrause avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.