TextBoxMaxSizeDemo.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.MIDlet;
- public class TextBoxMaxSizeDemo
- extends MIDlet
- implements CommandListener {
- private Display display;
- private TextBox textBox;
- private Form mainForm;
- private final static Command CMD_EXIT = new Command("Exit", Command.EXIT, 1);
- public TextBoxMaxSizeDemo() {
- display = Display.getDisplay(this);
- textBox = new TextBox("MaxSize Test","Test",50,0);
- try{
- textBox.setMaxSize(300000);
- }catch(Exception e){
- System.out.println(e.toString());
- }catch(Error err){
- System.out.println(err.toString());
- }
- System.out.println("实际大小:"+textBox.getMaxSize());
- }
- protected void startApp() {
- display.setCurrent(textBox);
- }
- protected void destroyApp(boolean unconditional) {
- }
- protected void pauseApp() {
- }
- public void commandAction(Command c, Displayable d) {
- if (c == CMD_EXIT) {
- destroyApp(false);
- notifyDestroyed();
- }
- }
- }