新按钮 [英] new button
本文介绍了新按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在运行时通过for循环创建10个具有不同名称的新按钮
:confused:
I want to create 10 new button with different name by for loop in run time
:confused:
推荐答案
使用黑莓api开发站点 ^ ]
Using the sample code on the blackberry api dev site here.[^]
FieldChangeListener listener = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
ButtonField buttonField = (ButtonField) field;
System.out.println("Button pressed: " + buttonField.getLabel());
}
};
for (int x=0; x< 10; x++)
{
ButtonField buttonField = new ButtonField("Test Button" + x);
buttonField.setChangeListener(listener);
}
我从未开发过Blackberry,所以不能肯定地说它是100%正确的,但是它将为您提供一个入门指南.
I have never developed on Blackberry, so can''t say for sure it 100% correct, but it will give you a starter.
这篇关于新按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文