%
% chapter Demos: HelloPsychophysicist.m
% 
% displays the text "Hello Psychophysicist (with Matlab)" 
% and two images on an otherwise entirely blank screen
%

import psychWithJava.*;
import javax.imageio.ImageIO;
import java.io.File;
  
try
    fs = FullScreen();
    fs.setNBuffers(2);
    
    fs.blankScreen();
    fs.displayText(...
        'Hello Psychophysicist (with Matlab)');
    fs.updateScreen();
    pause(2);
    
    fs.blankScreen();
    fs.hideCursor();
    
    bi1 = im2java2d(imread('psychophysik.png','PNG'));
    fs.displayImage(bi1);
    fs.updateScreen();
    pause(2);
    
    fs.blankScreen();
    
    bi2 = ImageIO.read(File('fechner.png'));

    fs.displayImage(0,0,bi2);
    fs.updateScreen();
    pause(2);
    
    fs.closeScreen();
catch
    fs.closeScreen();
    rethrow(lasterror);
end