小编Mur*_*ali的帖子

如何在BlackBerry Java中更改焦点时更改字段管理器的背景图像

我是黑莓手机的新手,可以选择创建菜单.每个选项都包含位图图像和标签.

这是第一个菜单项的代码:

hmf1_vfm1 = new VerticalFieldManager(Field.FIELD_HCENTER |          VErrticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.FIELD_HCENTER |   VerticalFieldManager.FOCUSABLE | Field.FOCUSABLE)
{
 boolean isFocus;
//Bitmap bmp1 = Bitmap.getBitmapResource("mnu_tile1.png");
protected void sublayout(int maxWidth, int maxHeight)
 {
super.sublayout(100,125);
setExtent(100,125);
 }

protected void paint(Graphics g) {
try
{
   //g.setBackgroundColor(0x504A4B);
   //g.drawBitmap(0, 0, bmp1.getWidth(), bmp1.getHeight(), bmp1, 0, 0);
                    g.clear();
    Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("mnu_tile1.png")); //mnu_tile1.png
                    this.setBackground(bg);
                    super.paint(g);
                }
                catch (IllegalArgumentException e) {
                    //SupportClass.showLog(TAG+" err 2 : "+e);
                }
            }

            protected void onFocus(int direction) {
                isFocus = true;
                super.onFocus(direction);
            }
            protected void onUnfocus() { …
Run Code Online (Sandbox Code Playgroud)

blackberry blackberry-jde

15
推荐指数
1
解决办法
492
查看次数

标签 统计

blackberry ×1

blackberry-jde ×1