상세 컨텐츠

본문 제목

DialogComponent

청강컴정/소프트웨어공학

by luckey 2009. 4. 6. 11:01

본문

Dialog생성
 
DialogComponent dialog1 = new DialogComponent(label1, "문자메시지1", DialogComponent.TYPE_NONE);
DialogComponent dialog2 = new DialogComponent(label2, "문자메시지2", DialogComponent.TYPE_OK, 10,10,100,100);

dialog1.doModal(); //화면에 다이알로그를 띄운다.

ActionListener를 상속받아 사용하고 abstrict method인 action method를 반드시 사용한다.



----Source----------------------------------------------------------------------------
import org.kwis.msp.lcdui.*;
import org.kwis.msp.lwc.*;

public class DialogEx extends Jlet implements ActionListener
{
 ShellComponent shell = new ShellComponent();
 FormComponent form = new FormComponent();
 LabelComponent label1 = new LabelComponent("메시지 전송중");
 LabelComponent label2 = new LabelComponent("메시지 전송완료!");

 TextBoxComponent textbox = new TextBoxComponent(null, TextBoxComponent.CONSTRAINT_ANY, 80);
 ButtonComponent button = new ButtonComponent("전송하기", null);
 DialogComponent dialog1 = new DialogComponent(label1, "문자메시지1", DialogComponent.TYPE_NONE);
 DialogComponent dialog2 = new DialogComponent(label2, "문자메시지2", DialogComponent.TYPE_OK, 10,10,100,100);

 
 protected void startApp(String[] args)
 {
  dialog1.setTimeout(3000);
  button.setActionListener(this, null);
  form.addComponent(textbox);
  form.addComponent(button);
  form.setGab(5);
  shell.setTitle("문자메시지 전송하기");
  shell.addComponent(form);
  shell.show();
 }

 protected void resumeApp(){};
 protected void pauseApp(){};
 protected void destroyApp(boolean b){};

 public void action(Component c, Object o)
 {
  if(c == button)
  {
   //label1.setLabel(textbox.getString());
   dialog1.doModal();
   dialog2.doModal();

   textbox.setString(null);
  }
 }
}

관련글 더보기

댓글 영역