import syeef.com.*;
public class Basics {
//

How to draw on HTML5 Canvas

This example shows how to draw a simple rectangle on HTML5 Canvas:

// HTML code
<canvas id="canvas" width="640" height="480"></canvas>

// JavaScript code
var canvas = document.getElementById("canvas");
var g = canvas.getContext("2d");
var x = 10;
var y = 10;
var width = 200;
var height = 150;
g.fillStyle = "#ff0000"; // set color red
g.fillRect(x, y, width, height);
}