需要现场经理Blackberry的帮助

时间:2011-08-11 17:51:55

标签: blackberry java-me

我一直收到IllegalArgumentException,当我运行此代码时,BlackBerry模拟器上没有显示任何内容。它可能有什么问题?

 public MyScreen()
    {        
        // Set the displayed title of the screen and add the weather icons      
        setTitle("PixWeather");

        cityField = new LabelField("Queensland", Field.FIELD_LEFT);
        tempField = new LabelField("17", Field.FIELD_RIGHT);

        condField = new LabelField("sunny",Field.FIELD_RIGHT);

       weather_icon = Bitmap.getBitmapResource("sun_icon.png");
        bitmapField = new BitmapField(weather_icon, Field.FIELD_LEFT);

        VerticalFieldManager vfield = new VerticalFieldManager();


        HorizontalFieldManager hfield1 = new HorizontalFieldManager();
        hfield1.add(cityField);
        hfield1.add(tempField);

        HorizontalFieldManager hfield2 = new HorizontalFieldManager();
        hfield2.add(bitmapField);
        hfield2.add(condField);

        vfield.add(hfield1);
        vfield.add(hfield2);

    }

1 个答案:

答案 0 :(得分:0)

IllegalArgumentException可能无关,但屏幕上没有显示任何内容,因为您没有在屏幕上添加任何内容。

您需要将vfield添加到屏幕本身。添加以下行:

add(vfield);