-1

我有n一些数据必须添加到标签字段中,而标签字段又必须添加到 hfm。我将单个数据设置为标签字段:

final LabelField desc = new LabelField("", LabelField.FOCUSABLE);
final LabelField desc1 = new LabelField("", LabelField.FOCUSABLE);

    Vector data = (Vector) listEvent.get(keys);
    for (int i = 0; i < data.size(); i++) {
       EventData ee = (EventData) data.elementAt(i);

    String Summary=    ee.getSummary();
     if (time.getText().equals(sTime)) {
                                                                                                             desc.setText(Summary);
     }
    else{
                 desc1.setText(Summary);

    }
}
    HorizontalFieldManager horizontalFieldManager_left18 = new HorizontalFieldManager() {

                 horizontalFieldManager_left18.add(desc1);
                 vfm.add(horizontalFieldManager_left18);
                    vfm.add(new SeparatorField());

    HorizontalFieldManager horizontalFieldManager_left17 = new HorizontalFieldManager() {

                 horizontalFieldManager_left17.add(desc);
                 vfm.add(horizontalFieldManager_left17);
                    vfm.add(new SeparatorField());

在上面的代码中,我循环遍历向量并将数据设置为稍后labelfield添加标签。hfm

现在的情况是矢量数据有多个汇总数据,并且数据被覆盖labelfield,我需要将n汇总数据的数量保留到标签字段中并添加到新的hfm

4

1 回答 1

1

我认为您是黑莓的新手;欢迎来到BB开发;

尝试这样做:

public class Abc extends MainScreen
{
private LabelField labelField[];
public Abc() 
{
    createGUI();
}
private void createGUI() 
{
    int size=10;
    labelField=new LabelField[size];//Here put your size; i.e., "data.size()"

    for(int i=0;i<size;i++)
    {
        labelField[i]=new LabelField("LabelField: "+(i+1), Field.FOCUSABLE);
        add(labelField[i]);
    }
}
}
于 2012-04-05T05:37:40.300 回答