gpt4 book ai didi

java - J2ME 命令命令

转载 作者:搜寻专家 更新时间:2023-11-01 02:33:08 25 4
gpt4 key购买 nike

我在我的应用程序中混合了一些不同类型的命令,如 OK、CANCEL、BACK、EXIT、SCREEN。

例如,

exit = new Command("Exit", Command.EXIT, 5);
_123=new Command("123",Command.BACK,4);
ABC=new Command("ABC",Command.CANCEL,3);
sample1=new Command("Sample1",Command.SCREEN,1);
sample2=new Command("Sample2",Command.OK,2);

我需要的订单是:Sample1,Sample2,ABC,Exit。但是它显示像这样 Sample1,Sample2,Exit,ABC 在右边,123 放在左边按钮。

在这里,我在使用如下所示添加一个命令(Edit_Cell)时也遇到了一个问题....我还需要在 Sample1 之前首先显示。但它显示在右侧所有命令的末尾边。

我在另一个 src 文件构造函数中添加了这个新命令(Edit_Cell),并在我上面的代码(添加命令)的下方调用了该构造函数。

Edit_Cell 是 SCREEN 类型,在另一个源文件中 PRIORITIES 是 1。

我需要的最终订单是:Edit_Cell,Sample1,Sample2,ABC,Exit,在右侧,_123 在左侧。

最佳答案

首先,无意冒犯,我认为你应该更详细地阐述你的书面作文,我花了一段时间才理解这个问题。

不过,根据这个(诺基亚的维基论坛),您声明命令的方式是有意义的:

The Command mapping to softkeys follow following rules:

Right softkey: There can be only one "negative" Command (STOP, CANCEL, BACK, EXIT in this priority order) mapped to Right softkey, and the Command mapped there is directly invoked by softkey press.

Left softkey: Mutiple commands can be mapped under Left softkey in which case there is "Options" label in Left softkey and selection of it will open a menu of commands. If there's however only a single "positive" Command (OK, ITEM, SCREEN or HELP) under left softkey it will be presented directly on Left softkey. (Note: Some LCDUI components have their own operations that will be also visible under left softkey thus forcing Options menu.) If there's more than one negative Command this will force Options menu on Left softkey and the commands will be presented in the order define below.

Middle softkey: In Series 40 only a single context sensitive Command (OK, ITEM) is mapped to Middle softkey. In S60 multiple context sensitive Commands (OK, ITEM) can be mapped to Middle Softkey. If there's only single Command it will be shown directly in softkey, otherwise commands are visible in context sensitive menu opened from middle softkey. Normally the same commands mapped to Middle softkey are also available in Left softkey (directly or via Options menu). Note: Some UI components override this rule and place component specific operation directly to Middle softkey. For example, POPUP ChoiceGroup has "Open" operation in Middle softkey.

显然这在很大程度上取决于平台,但您的 midlet 似乎假设 _123 为否定命令,所有其他命令都放在另一个软键上。

我会尝试根据您的意愿更改类型并设置优先级...像这样

exit = new Command("Exit", Command.EXIT, 5);
_123=new Command("123",Command.BACK,0);
ABC=new Command("ABC",Command.SCREEN,3);
sample1=new Command("Sample1",Command.SCREEN,1);
sample2=new Command("Sample2",Command.OK,2);

并且您可以将Edit_Cell 的优先级设置为0,并将其类型设置为SCREEN。只需添加:ITEM 命令通常放在前面。

希望对您有所帮助。问候。

关于java - J2ME 命令命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4655161/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com