title: Blackberry add border to image when focus
body: <p>I'm trying to make touchable image which can focus when I scroll it by touchable button on device this is my code for touchable image:</p>
  
  <pre><code>class TouchBitmapField extends BitmapField {
      Bitmap bitmap;
      boolean second;
      int width;
      public TouchBitmapField(Bitmap startBitmap, long style, int width, boolean second) {
          super(startBitmap, style);
          this.second = second;
          bitmap = startBitmap;
          this.width = width;
      }
  
      protected void drawFocus(Graphics g, boolean on){
          g.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true );
          if(on){
             drawHighlightRegion(g, Field.HIGHLIGHT_FOCUS, on, width-(bitmap.getWidth()/2), 0, bitmap.getWidth(), bitmap.getHeight());
          }
  
          paint(g);
      }
      protected boolean touchEvent(TouchEvent message) {
          if (TouchEvent.CLICK == message.getEvent()) {
              FieldChangeListener listener = getChangeListener();
              if (null != listener)
                  listener.fieldChanged(this, 1);
          }
          return super.touchEvent(message);
      }
  }
  </code></pre>
  
  <p>But the problem is that only transparent part of image can focus and I'm resising this Bitmap before create TouchBitmapField and as you maybe know resising bitmap remove transparent part and replace it with black. I tried this class <a href="http://www.patchou.com/2010/10/resizing-transparent-bitmaps-with-the-blackberry-jde/" rel="nofollow">http://www.patchou.com/2010/10/resizing-transparent-bitmaps-with-the-blackberry-jde/</a>  to resize image but I have 25 images on my screen and it's inefficient. Any idea how to make border on image? Any efficient way to draw border in <code>drawFocus(Graphics g, boolean on)</code> method?</p>