public class Canvas
  Comment     Returned-by     Constructor-argument     Method-argument     Field-type     Type-bound     Links  

Canvas is an image that can be drawn on using a set of graphics commands provided by a GraphicsContext.

A Canvas node is constructed with a width and height that specifies the size of the image into which the canvas drawing commands are rendered. All drawing operations are clipped to the bounds of that image.

Example:

import javafx.scene.*;
import javafx.scene.paint.*;
import javafx.scene.canvas.*;

Group root = new Group();
Scene s = new Scene(root, 300, 300, Color.BLACK);

final Canvas canvas = new Canvas(250,250);
GraphicsContext gc = canvas.getGraphicsContext2D();

gc.setFill(Color.BLUE);
gc.fillRect(75,75,100,100);

root.getChildren().add(canvas);
 

extends Node

See also:
GraphicsContext

Since:  JavaFX 2.2