Skip to main content

How to a still image ?

No replies
terymas
Offline
Joined: 2007-09-03
Points: 0

Somebody now ?
Many thanks,

Tery

My code :

import java.awt.Color;
import java.awt.Font;
import java.awt.Component;
import java.awt.Graphics;
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import javax.tv.xlet.XletStateChangeException;
import org.havi.ui.HGraphicsDevice;
import org.havi.ui.HBackgroundDevice;
import org.havi.ui.HScene;
import org.havi.ui.HSceneFactory;
import org.havi.ui.HScreen;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.tv.xlet.*;
import org.davic.net.dvb.DvbLocator;
import org.havi.ui.*;
import java.awt.Color;

public class SampleXlet extends Component implements Xlet, KeyListener
{
private HScene hscene = null;
int PushEvent = 0;

private void DebugMessage(String strMsg)
{
System.out.println("DEBUG MESSAGE: " + strMsg);
}
private HScene getHScene() {
if (hscene == null) {
HSceneFactory f = HSceneFactory.getInstance();
HScreen s = HScreen.getDefaultHScreen();
HGraphicsDevice gd = s.getDefaultHGraphicsDevice();
hscene = f.getFullScreenScene(gd);
setBounds(hscene.getBounds());
hscene.add(this);
}
DebugMessage("check constructor Xlet : Xlet constructor checked");
return hscene;
}

public void initXlet(XletContext ctx) throws XletStateChangeException {

addKeyListener(this);
getHScene().setVisible(true);
requestFocus();
DebugMessage("check init Xlet : Xlet initilized");
}

public void startXlet() throws XletStateChangeException
{
DebugMessage("check start Xlet : Xlet started");}

public void pauseXlet(){}

public void destroyXlet(boolean unconditional)
throws javax.tv.xlet.XletStateChangeException
{
DebugMessage("check destroy Xlet : Xlet destroy");
}
HBackgroundDevice backdevice;

public void paint(Graphics g)
{
DebugMessage("START paint");

g.setFont(new Font("Bitstream Vera Sans",Font.PLAIN,32));
g.setColor(Color.white);

int nLineNum = 12;
if (PushEvent ==1){
g.drawString("Remote Active : BTN 01", 50, 50 + nLineNum++ * g.getFont().getSize() + 10);}
else{
g.drawString("My Xlet", 50, 50 + nLineNum++ * g.getFont().getSize() + 10);}

DebugMessage("END paint");
}
public void keyPressed(KeyEvent evt) {
PushEvent = 0;
DebugMessage("START keyPressed");
int code = evt.getKeyCode();
switch (code) {

case KeyEvent.VK_0 :
break;

case KeyEvent.VK_1 :
PushEvent = 1;
break;
case KeyEvent.VK_2 :
break;
case KeyEvent.VK_3 :
break;
case KeyEvent.VK_4 :
break;
case KeyEvent.VK_5 :
break;
case KeyEvent.VK_6 :
break;
case KeyEvent.VK_7 :
break;
case KeyEvent.VK_8 :
break;
case KeyEvent.VK_9 :
break;
}
repaint();
DebugMessage("END keyPressed");
}
public void keyReleased(KeyEvent e) {}
public void keyTyped(KeyEvent e) {}

}

Message was edited by: terymas