1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
package org.homebrew;
import java.awt.*;
import java.awt.event.*;
import javax.tv.xlet.*;
import org.havi.ui.*;
public class MyXlet extends Component implements Xlet{
private HScene hs;
Image img;
public void initXlet(XletContext context){
MediaTracker mt = new MediaTracker(this);
try{
Toolkit toolkit = Toolkit.getDefaultToolkit();
img = toolkit.getImage(this.getClass().getResource("test.png"));
mt = new MediaTracker(this);
mt.addImage(img, 0);
mt.waitForAll();
}catch(Exception e) {
}
hs= HSceneFactory.getInstance().getFullScreenScene(HScreen.getDefaultHScreen().getDefaultHGraphicsDevice());
setBounds(hs.getBounds());
hs.add(this);
hs.setVisible(true);
requestFocus();
repaint();
}
public void startXlet(){ }
public void pauseXlet(){ }
public void destroyXlet(boolean unconditional){ }
public void paint(Graphics g){
g.setColor(new Color(255,255,255));
g.fillRect(0,0,32,32);
g.drawImage(img,16,16,this);
}
}
|