Problème affichage image sur N95
Bonjour,
Je viens vers vous car mon image ne s'affiche pas sur mon N95, alors que sur l'émulateur pas de souci.
Voici le code que j'utilise :
Code:
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.*;
import java.io.IOException;
public class Affiche extends MIDlet {
private Display _display;
private Moteur _moteur;
public Affiche()
{
_moteur = new Moteur();
_display = Display.getDisplay(this);
}
class Moteur extends Canvas
{
private int _height,_zoneH;
private int _width,_zoneW;
public Moteur()
{
_height = getHeight();
_width = getWidth();
_zoneW = _width -5 ;
_zoneH = _height -5;
}
protected void paint(Graphics g)
{
g.setColor(0xffffff);
g.fillRect(0, 0, _width, _height);
Image source;
try
{
source = Image.createImage("Test.PNG");
}
catch (IOException e)
{
throw new RuntimeException ("Unable to load Image - "+e);
}
g.drawImage(source, _height/2, _width/2, Graphics.VCENTER|Graphics.HCENTER);
}
}
protected void keyPressed(int keyCode)
{
}
protected void keyReleased(int keyCode)
{
}
public void startApp() {
_display.setCurrent(_moteur);
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
} |
Il y a peut-être quelque chose à rajouter pour que l'image s'affiche sur le N95.
Merci par avance