상세 컨텐츠

본문 제목

DateFieldComponent

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

by luckey 2009. 4. 6. 12:02

본문

MODE_TIME, MODE_DATE, MODE_TIME_DATE



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

public class DataEx extends Jlet implements ActionListener
{
 ShellComponent shell = new ShellComponent();
 FormComponent form = new FormComponent();
 ButtonComponent button = new ButtonComponent("모드 바꾸기", null);
 LabelComponent label = new LabelComponent("날짜출력");

 DateFieldComponent date = new DateFieldComponent(DateFieldComponent.MODE_DATE);
 
 protected void startApp(String[] args)
 {
  button.setActionListener(this, null);
  
  form.addComponent(label);
  form.addComponent(date);
  form.addComponent(button);
  form.setGab(10);
  shell.addComponent(form);
  shell.show();
 }

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

 public void action(Component c, Object o)
 {
  switch(date.getMode())
  {
   case DateFieldComponent.MODE_DATE:
    date.setMode(DateFieldComponent.MODE_TIME_DATE);
    break;
   case DateFieldComponent.MODE_TIME_DATE:
    date.setMode(DateFieldComponent.MODE_TIME);
    break;
   case DateFieldComponent.MODE_TIME:
    date.setMode(DateFieldComponent.MODE_DATE);
    break;
  }
 }
}

관련글 더보기

댓글 영역