Interfaccia per scattare la foto

public class PhotoCanvas extends Canvas
{
    private Player player = null;
    private VideoControl vc = null;
    
    private int canvasWidth = 0;
    private int canvasHeight = 0;
    
    private FotoDemo fotodemo = null;
    
    private boolean playerActive = false;
    
    public Command exit = null;
    public Command back = null;
    
    private Image imageCaptured = null;
    
    public PhotoCanvas(FotoDemo fotodemo)
    {
        super();
        this.fotodemo = fotodemo;
        setFullScreenMode(true);
        canvasWidth = getWidth();
        canvasHeight = getHeight();
        exit = new Command("Esci", Command.EXIT, 1);
        back = new Command("Back", Command.BACK, 1);
        addCommand(exit);
        
        setCommandListener(fotodemo);
        buildPlayer();
    }
    
    public void buildPlayer()
    {
        try
        {
            player=Manager.createPlayer("capture://video");
            player.realize();
            vc=(VideoControl)(player.getControl("VideoControl"));
            if (vc == null)
            {
                // Il videocontrol non può essere creato.
                throw new MediaException("Video control not supported");
            }
            else
            {
                vc.initDisplayMode(VideoControl.USE_DIRECT_VIDEO,this);
                
                int vcWidth = vc.getDisplayWidth();
                int vcHeight = vc.getDisplayHeight();
                
                int x = (canvasWidth - vcWidth)/2;
                int y = (canvasHeight - vcHeight)/2;
                
                vc.setDisplayLocation(x, y);
            }
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        catch (MediaException e)
        {
            e.printStackTrace();
        }
    }

....//