글
JAVA
import org.kwis.msp.lcdui.*;
import org.kwis.msp.lwc.*;
import java.io.IOException;
public class CommandEx extends Jlet implements CommandListener {
ShellComponent shell = new ShellComponent();
CommandBarComponent combar = new CommandBarComponent();
Image image1, image2, image3;
Command cmd1, cmd2, cmd3;
protected void startApp(String args[]) {
try
{
image1 = Image.createImage("star.gif");
image2 = Image.createImage("circle.gif");
image3 = Image.createImage("cancel.gif");
}catch(IOException e){}
cmd1 = new Command("별",image1, cmd1);
cmd2 = new Command("원",image2, cmd2);
cmd3 = new Command("취소",image3, cmd3);
combar.addCommand(cmd1);
combar.addCommand(cmd2);
combar.addCommand(cmd3);
combar.setCommandListener(this, null);
shell.setCommand(combar, false);
shell.show();
}
protected void destroyApp(boolean b){}
public void commandAction(Command c, int t, Object o)
{
if(c == cmd1 && t == SELECT)
{
LabelComponent label = new LabelComponent(null, image1);
DialogComponent dialog = new DialogComponent(label, "별 모양 선택", DialogComponent.TYPE_NONE);
dialog.setTimeout(2000);
dialog.doModal();
}
if(c == cmd2 && t == SELECT)
{
LabelComponent label = new LabelComponent(null, image2);
DialogComponent dialog = new DialogComponent(label, "원 모양 선택", DialogComponent.TYPE_OK);
dialog.doModal();
}
if(c == cmd3 && t == SELECT)
{
LabelComponent label = new LabelComponent(null, image3);
DialogComponent dialog = new DialogComponent(label, "취소 선택", DialogComponent.TYPE_NONE);
dialog.setTimeout(2000);
dialog.doModal();
}
}
}