screenscroll.java
来自「键盘事件实现屏幕的滚动」· Java 代码 · 共 70 行
JAVA
70 行
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 + =
减小字号Ctrl + -
显示快捷键?