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

Links

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

Removed banner.txt to not override the banner of a Spring boot app.

Released
2019-01-03
Maturity
EXPERIMENTAL
License
Apache License 2.0

Compatibility

Framework
Vaadin 10+
Browser
Firefox
Google Chrome
Internet Explorer
Microsoft Edge
Online