JAVA

프로그래밍 2009. 4. 15. 02:11

import org.kwis.msp.lcdui.*;
import org.kwis.msp.lwc.*;
import java.io.IOException;

public class ImageEx extends Jlet implements CommandListener
{
 ShellComponent shell = new ShellComponent();

 CommandBarComponent combar = new CommandBarComponent();
 ImageComponent img = new ImageComponent();
 Command cmd1, cmd2;
 Image image1, image2;

 protected void startApp(String args[])
 {
  try
  {
   image1 = Image.createImage("play.gif");
   image2 = Image.createImage("stop.gif");
  }catch(IOException e){}
  img.setImage("ani.gif");
  img.setLayout(Component.LAYOUT_HCENTER | Component.LAYOUT_VCENTER);

  cmd1 = new Command("시작", image1, cmd1);
  cmd2 = new Command("정지", image2, cmd2);
  combar.addCommand(cmd1);
  combar.addCommand(cmd2);

  combar.setCommandListener(this, null);

  shell.addComponent(img);
  shell.setCommand(combar, false);
  shell.show();
 }
  
 protected void paseApp(){}
 protected void resumeApp(){}
 protected void destroyApp(boolean b){}
 public void commandAction(Command c, int t, Object o)
 {
  if(c == cmd1 && t == SELECT)
   img.play();
  
  if(c == cmd2 && t == SELECT)
   img.stop();
 }
}

'프로그래밍' 카테고리의 다른 글

JAVA  (0) 2009.04.23
JAVA  (1) 2009.04.21
JAVA  (1) 2009.04.20
JAVA  (0) 2009.04.19
JAVA  (0) 2009.04.16
JAVA  (0) 2009.04.12
JAVA  (0) 2009.04.10
JAVA  (0) 2009.04.07
JAVA  (0) 2009.04.04
JAVA  (0) 2009.04.03

설정

트랙백

댓글