- ResourceClientの実装
- バックグラウンドプレーンのリザーブ
- HStillImageBackgroundConfigurationの取得
- JPEGファイルからHBackgroundImageを生成
- HBackgroundImageの表示
- HBackgroundImageの開放
- バックグラウンドプレーンのリリース
Main.java
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import org.davic.resources.ResourceClient;
import org.davic.resources.ResourceProxy;
import org.havi.ui.HBackgroundConfigTemplate;
import org.havi.ui.HBackgroundDevice;
import org.havi.ui.HBackgroundImage;
import org.havi.ui.HScreen;
import org.havi.ui.HStillImageBackgroundConfiguration;
 
public class Main implements Xlet, ResourceClient{
    HBackgroundDevice device;
    HBackgroundImage image,image2;
    public void initXlet(XletContext context){
        try {
            HScreen screen = HScreen.getDefaultHScreen();
            device = screen.getDefaultHBackgroundDevice();
            device.reserveDevice(this);
            HBackgroundConfigTemplate template = new HBackgroundConfigTemplate();
            HStillImageBackgroundConfiguration configuration = 
                (HStillImageBackgroundConfiguration)device.getBestConfiguration(template);
            image = new HBackgroundImage("test1.jpg");
            image2 = new HBackgroundImage("test2.jpg");
            for( ;; ){
               configuration.displayImage(image);
               configuration.displayImage(image2);
            }
        } catch(Throwablethr) {
        }
    }
    public void startXlet(){	}
    public void pauseXlet(){	}
    public void destroyXlet(boolean unconditional){
        device.releaseDevice();
        image.flush();
        image2.flush();
    }
    /* ResourceClientのmethod */
    public void notifyRelease(ResourceProxy proxy) { }
    public void release(ResourceProxy proxy) { }
    public boolean requestRelease(ResourceProxy proxy, Object requestData) { return false; }