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

📄 screenscroll.java

📁 键盘事件实现屏幕的滚动
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class ScreenScroll extends MIDlet implements CommandListener{
///测试Alert的应用 
/*	Alert alert = null;
	Display display = null;
	Form form = null;
	Command ok = null;

	public ScreenScroll(){
	alert = new Alert("warning","You have entered Wrong serial number",null,AlertType.WARNING);
	display = Display.getDisplay(this);
	form = new Form("Alert test!");
	ok = new Command("ok",Command.SCREEN,1);
	form.addCommand(ok);
	form.setCommandListener(this);

	}
	public void startApp(){
	display.setCurrent(alert,form);
	}

	public void pauseApp(){
	
	}

	public void destroyApp(boolean b){
	
	}
	public void commandAction(Command com,Displayable d){
	if (com == ok)
	{

	}
	}*/


//在Screen 中使用Scroll

 Command cmdExit = null;
  
  public ScreenScroll(){}
  
  public void startApp(){
         cmdExit = new Command("Exit",Command.EXIT,0);
         TextBox textBox = new TextBox("Hello Midlet","Hello world !!",256,0);
         textBox.addCommand(cmdExit);
         textBox.setCommandListener((CommandListener)this);
         Ticker tickerExample = new Ticker("This is a scrolls slowly!......");
         Screen s = (Screen)textBox;
         s.setTicker(tickerExample);
         Display.getDisplay(this).setCurrent(textBox);
  }
  public void pauseApp(){
  
  }
  
  public void destroyApp(boolean b){
  
  }
  public void commandAction(Command com ,Displayable dis){
  if(com == cmdExit){
          destroyApp(false);
          notifyDestroyed();
  }
  }


}

⌨️ 快捷键说明

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