2011-03-25 45 views
0

我正在用使用FramedForm的J2ME Polish開發應用程序。J2ME Polish FramedForm命令

我想追加一個與Command1相關聯的項目到FramedForm和另一個與Command2相關的項目到FramedForm的底部。

FramedForm menuForm = new FramedForm("Menu"); 

Command command1 = new Command("command1", Command.ITEM, 1); 
Command command2 = new Command("command2", Command.ITEM, 2); 

IconCustomItem item1 = new IconCustomItem("test1", null); 
item1.addCommand(Command1); 
menuForm.append(item1); 

IconCustomItem item2 = new IconCustomItem("test2", null); 
item2.addCommand(Command2); 
menuForm.append(Graphics.BOTTOM, item2); 

問題是頁腳項目與兩個命令都關聯。我試過用removeCommands()沒有成功。我如何才能將頁腳項目關聯到Command2?

謝謝。

回答

0

嘗試設置每個項目的默認命令,而不是添加單個命令。 像:

item1.setDefaultCommand(command1); 

See爲命令上的項目的詳細信息:

+0

當我使用setDefaultCommand而不是addCommand時會發生同樣的情況。 – 2011-03-28 08:11:48