⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 text.java

📁 非富多彩的十六个J2ME的例子
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class text extends MIDlet implements CommandListener
{
  Display dis;
  Form frm1,frm2;
  Command cmdexit=new Command("Exit",Command.EXIT,1);
  Command cmdok=new Command("Ok",Command.OK,0);
  Command cmdback=new Command("Back",Command.BACK,2);
  Ticker tick1,tick2;
  
  
  public text()
  {
  	
  	
  }
  
  public void commandAction(Command c, Displayable d)
  {
  	 if(c==cmdexit)
  	   destroyApp(true);
  	   
  	 else if(c==cmdok)
  	 showform2();
  	 
  	 else if(c==cmdback)
  	 showform1();
  	
  }
  
  public void startApp() throws MIDletStateChangeException
  {
  	StringItem str1=new StringItem("Message","");
  	StringItem str2=new StringItem("Message","");
  	tick1=new Ticker("Scrolling text");
  	tick2=new Ticker("Scrolling text");
  	dis=Display.getDisplay(this);
  	frm1=new Form("Presto Systems");
  	frm2=new Form("About us");
  	frm1.addCommand(cmdexit);
  	frm1.addCommand(cmdok);
  	frm1.setCommandListener(this);
  	frm1.setTicker(tick1);
  	frm2.setTicker(tick2);
  	frm2.addCommand(cmdexit);
  	frm2.addCommand(cmdback);
  	frm1.append(str1);
  	frm2.append(str2);
  	dis.setCurrent(frm1);
  	
  }
	
   public void destroyApp(boolean unconditional) 
  {
     notifyDestroyed();	
  }
  
  public  void pauseApp() 
  {
  	
  } 
  
  public void showform1()
  {
     frm1.addCommand(cmdexit);
     frm1.addCommand(cmdok);
     frm1.setCommandListener(this);
     dis.setCurrent(frm1);	
  	
  }
  
  public void showform2()
  {
     frm2.addCommand(cmdexit);
     frm2.addCommand(cmdback);
     frm2.setCommandListener(this);
     frm2.setTicker(tick2);
     dis.setCurrent(frm2);	
  	
  }
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -