Frustration using Canvas component, web page is blank

I am using openJDK 8 in windodws 10, vaadin 14.1.27. I follow the instructions of Pekka’s/2/ code example/1/,

After I have compiled and run, I was shown a blank page when invoke local address: http://localhost:8080, anything wrong? I have download svg from Pekka’s github.

/1/

package org.example;

import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.server.PWA;
import com.vaadin.flow.router.Route;
import org.vaadin.pekkam.Canvas;
import org.vaadin.pekkam.CanvasRenderingContext2D;
@Route
@PWA(name = "My Application", shortName = "My Application")
public class MainView extends VerticalLayout {

    public MainView() {
        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);


    }
}

/2/
https://vaadin.com/directory/component/canvas-java/samples

Hi,

In your code, you didn’t add the canvas in your view.
You can add it with this code:
add(canvas)

Thank you for the help, Jean-Christophe Gueriaud!