开发者

How to create same Command in Java ME

开发者 https://www.devze.com 2023-04-10 14:39 出处:网络
i want to use same command for another form in java me. i only see how to create commands but re use it on another form is not. is it possible or should i just copy paste my code to 开发者_开发百科oth

i want to use same command for another form in java me. i only see how to create commands but re use it on another form is not. is it possible or should i just copy paste my code to 开发者_开发百科other forms that ill make?


lcdui Command is plain old Java object, its instances can be reused and passed around just like any other Java objects

import javax.microedition.lcdui.Command;

// usage: CommandPool.cmdHello, CommandPool.cmdBye
public class CommandsPool {
    public static final Command
        cmdHello = new Command("Hello", Command.OK, 0),
        cmdBye = new Command("Bye", Command.EXIT, 0);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消