Directory

← Back

Canvas Java

Canvas component for Vaadin 10+

Author

Contributors

Rating

This is a Java integration of the HTML5 <canvas> for Vaadin Platform.

It provides a subset of the client-side JavaScript API to Java users.

Sample code

Canvas canvas = new Canvas(800, 500);
CanvasRenderingContext2D ctx = canvas.getContext();

// Draw a red line from point (10,10) to (100,100):
ctx.setStrokeStyle("red");
ctx.beginPath();
ctx.moveTo(10, 10);
ctx.lineTo(100, 100);
ctx.closePath();
ctx.stroke();

// Draw an image located in src/main/webapp/resources:
ctx.drawImage("resources/vaadin-logo.svg", 0, 0));

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Vaadin 24 compatible version with lot of new features. First release via Maven Central.

Released
2023-04-28
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 24
Vaadin 23 in 1.0.1
Vaadin 14 in 1.0.1
Vaadin 10 in 1.0.1
Browser
Browser Independent
Online