Splash dalam netbeans



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;

/**
* @author Administrator
*/
public class m_splash extends MIDlet {
coba_canvas cc ;
Display tampil ;


public void startApp() {
cc = new coba_canvas(this);
cc.mulai_splash ();
tampil = Display.getDisplay(this);
tampil.setCurrent(cc);
}

public void pauseApp() {
}
void keluar_midlet (){
destroyApp(true);
notifyDestroyed();
}

public void destroyApp(boolean unconditional) {

}
}





untuk java class nya :

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author Administrator
*/
public class coba_canvas extends Canvas implements Runnable {
m_splash ms ;
Command exitCommand = new Command("exit", Command.EXIT, 1);
Image kucing ;
boolean mulai = true ;
long tunda ;

coba_canvas(m_splash ms) {
this.ms = ms;
try {
kucing = Image.createImage("/sp.png");
}catch (Exception e){
e.printStackTrace();
}

}


protected void paint(Graphics g) {
g.setColor(255, 255, 255);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(0, 0, 0);
g.drawImage(kucing, 0, 0, Graphics.TOP | Graphics.LEFT);
}
public void mulai_splash() {
Thread t = new Thread(this);
t.start();
}
public void run() {
boolean tt = true ;
try {
while (mulai) {
tunda = 1000 ;
System.out.println("mulai");
if (!tt) {
mulai = false ;

}
tt = false ;
Thread.sleep(tunda);
}
ms.keluar_midlet();
}
catch (Exception ex){
ex.printStackTrace();
}
}
}


Komentar

Postingan Populer