Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 黑莓位图侦听器_Blackberry_Listener_Paint - Fatal编程技术网

Blackberry 黑莓位图侦听器

Blackberry 黑莓位图侦听器,blackberry,listener,paint,Blackberry,Listener,Paint,我有一个类似于下面的代码,在这个mIcon的地图字段上画了几次。 如何将单击侦听器添加到此位图?我正在使用BB5.0 public Bitmap mIcon; mIcon = Bitmap.getBitmapResource("pcture1.png"); protected void paint(Graphics g) { super.paint(g); mDest = new XYRect(....); g.drawBitmap(mDest, mIco

我有一个类似于下面的代码,在这个mIcon的地图字段上画了几次。 如何将单击侦听器添加到此位图?我正在使用BB5.0

public Bitmap mIcon;
mIcon = Bitmap.getBitmapResource("pcture1.png");

protected void paint(Graphics g) {


 super.paint(g);
        mDest = new XYRect(....);
        g.drawBitmap(mDest, mIcon, 0, 0);
}

重写BitmapField并修改isFocusable()、navigationClick()、keyChar()和trackwheelClick()方法

public class ImageButtonField extends BitmapField
{

   public ImageButtonField(Bitmap image)
   {
      super(image);
   }

   public boolean isFocusable() 
   {
      return true;
   }

   protected boolean navigationClick(int status, int time)
   {
     fieldChangeNotify(0);
     return true;
   }

   protected boolean trackwheelClick(int status, int time)
   {
     fieldChangeNotify(0);
     return true;
   }

   protected boolean keyChar(char character, int status, int time)
   {
      if(Characters.ENTER == character || Characters.SPACE == character)
      {
         fieldChangeNotify(0);
         return true;
      }
      return super.keyChar(character, status, time);
   }

}

你好,谢谢你的回答。如何将其添加到地图字段?图标是否应根据与屏幕相关联的地图中心动态添加?您好,Jonathan,如何使用图形绘制位图字段?导航点击是否也适用于点击事件?