private void drawBtnStyle(Graphics gfx) {
    final int initialColor = gfx.getColor();

    // draw border
    gfx.setColor(0x424242);
    gfx.drawLine(w - 1, 0, w - 1, h - 3);
    gfx.drawLine(0, h - 1, w - 1, h - 1);

    gfx.setColor(Color.BLACK);
    gfx.drawLine(w - 2, 0, w - 2, h - 2);
    gfx.drawLine(0, h - 2, w - 1, h - 2);

    gfx.setColor(initialColor);

    // corners are equal in size, so we can use just one value for both corners
    final int cornerWidth = BTN_STYLE_LEFT_CORNER.getWidth();
    final int middleWidth = w - 2 * cornerWidth - 2;

    // height is equal for all three pieces
    final int height = BTN_STYLE_LEFT_CORNER.getHeight();

    // draw left corner
    gfx.drawBitmap(0, 0, cornerWidth, height, BTN_STYLE_LEFT_CORNER, 0, 0);

    final EncodedImage middle = ImageUtils.resize(BTN_STYLE_MIDDLE, middleWidth + 1, height, false);

    // draw middle
    gfx.drawImage(cornerWidth, 0, middleWidth, height, middle, 0, 0, 0);

    // draw right corner
    gfx.drawBitmap(cornerWidth + middleWidth, 0, cornerWidth, height, BTN_STYLE_RIGHT_CORNER, 0, 0);
  }
  protected void paintBackground(Graphics g) {
    // paint my bubble
    int col = g.getColor();

    int height = this.getContentHeight();
    // int width = this.getContentWidth();
    int width = this.getWidth();

    // draw corners
    g.drawBitmap(0, 0, 17, 17, blue_bubble, 0, 0); // left top
    g.drawBitmap(width - 11, 0, 10, 10, blue_bubble, 36, 0); // right top
    g.drawBitmap(0, height - 11, 17, 11, blue_bubble, 0, 17); // left bottom
    g.drawBitmap(width - 11, height - 11, 11, 11, blue_bubble, 36, 17); // right bottom
    // draw borders
    g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 0, width - 27, 9, blue_top_bar, 0, 0);
    g.tileRop(Graphics.ROP_SRC_ALPHA, 7, 17, 10, height - 28, blue_left_bar, 0, 0);
    g.tileRop(Graphics.ROP_SRC_ALPHA, 17, height - 11, width - 27, 11, blue_bottom_bar, 0, 0);
    g.tileRop(Graphics.ROP_SRC_ALPHA, width - 15, 10, 9, height - 21, blue_right_bar, 0, 0);

    // draw inside bubble
    // g.tileRop(Graphics.ROP_SRC_ALPHA, 17, 10, width-27, height-19, grey_inside_bubble, 0, 0);
    g.setColor(0x00FAFAFA);
    g.fillRect(17, 9, width - 28, height - 19);

    g.setColor(col);
    super.paintBackground(g);
  }
  private void paintSliderBackground(Graphics g, Bitmap left, Bitmap middle, Bitmap right) {
    int sliderHeight = _imageSlider.getHeight();
    int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1;

    // Left
    g.drawBitmap(0, sliderBackYOffset, _xLeftBackMargin, sliderHeight, left, 0, 0); // lefttop
    // Middle
    g.tileRop(
        _rop,
        _xRightBackMargin,
        sliderBackYOffset,
        _totalWidth - _xLeftBackMargin - _xRightBackMargin,
        sliderHeight,
        middle,
        0,
        0); // top
    // Right
    g.drawBitmap(
        _totalWidth - _xRightBackMargin,
        sliderBackYOffset,
        _xRightBackMargin,
        sliderHeight,
        right,
        0,
        0); // lefttop
  }
Example #4
0
  public void drawListRow(ListField list, Graphics g, int index, int y, int w) {

    Font font = g.getFont();
    int xPos = 30;
    int yPos = y + (list.getRowHeight() - imagee1.getHeight()) / 2;
    int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2;

    if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {
      g.setBackgroundColor(0x005A6971);
      // g.setBackgroundColor(0x005A6971);
      // g.drawRoundRect(0, 0, 630, 80, 15, 15);
      g.clear();
    } else {
      g.setColor(Color.WHITE);
      // g.drawRoundRect(0, 0, 630, 80, 15, 15);
    }

    for (int i = 0; i < bit.length; i++) {
      image = bit[index];
      g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(), image, 0, 0);
    }

    g.setFont(Constants.fontBold);
    xPos = xPos + image.getWidth();
    String text = (String) listElements.elementAt(index);
    g.drawText(text, xPos, yPosTxt);
    g.setFont(Constants.fontVerySmall);

    //		for (int i = 0; i < bit.length; i++) {
    //			xPos = 30 + image.getWidth();
    //			String textSubText = Constants.selectedBranch;
    //			g.drawText(textSubText, xPos, yPosTxt + 25);
    //		}

    xPos = 30 + image.getWidth();

    switch (index) {
      case 0:
        String textSubText = Constants.selectedBranch;
        g.drawText(textSubText, xPos, yPosTxt + 25);
        break;

      case 1:
        String textProcessText = Constants.selectedProcess;
        g.drawText(textProcessText, xPos, yPosTxt + 25);
        break;

      case 2:
        String textLocationText = Constants.selectedLocation;
        g.drawText(textLocationText, xPos, yPosTxt + 25);
        break;
    }

    g.drawBitmap(580, yPos + 3, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0);
  }
 // Bitmap grey = Const.getGrey();
 public void paint(Graphics g) {
   int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()};
   int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0};
   g.setColor(2500134);
   g.drawFilledPath(xPts, yPts, null, null);
   // g.drawTexturedPath(xPts,yPts,null,null,0,this.getTop(),Fixed32.ONE,0,0,Fixed32.ONE,grey);
   if (focus) {
     g.drawBitmap(6, 0, button_select.getWidth(), button_select.getHeight(), button_select, 0, 0);
   } else {
     g.drawBitmap(
         6, 0, button_thumbnail.getWidth(), button_thumbnail.getHeight(), button_thumbnail, 0, 0);
   }
 }
Example #6
0
 protected void paint(Graphics g) {
   g.setFont(fontSetting.getFont());
   boolean focus = g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS);
   int textColor = Color.BLACK;
   if (focus) {
     g.setColor(Color.GREEN);
     g.fillRect(0, 0, 5, getHeight());
   }
   if (locked) {
     textColor = Color.GRAY;
     g.drawBitmap(
         getWidth() - 5 - lock.getWidth(),
         (getHeight() - lock.getHeight()) / 2,
         lock.getWidth(),
         lock.getHeight(),
         lock,
         0,
         0);
   } else {
     if (focus) {
       g.drawBitmap(
           getWidth() - 5 - focusArrow.getWidth(),
           (getHeight() - focusArrow.getHeight()) / 2,
           focusArrow.getWidth(),
           focusArrow.getHeight(),
           focusArrow,
           0,
           0);
     } else {
       g.drawBitmap(
           getWidth() - 5 - normalArrow.getWidth(),
           (getHeight() - normalArrow.getHeight()) / 2,
           normalArrow.getWidth(),
           normalArrow.getHeight(),
           normalArrow,
           0,
           0);
     }
   }
   g.drawBitmap(
       25,
       (getHeight() - image.getHeight()) / 2,
       image.getWidth(),
       image.getHeight(),
       image,
       0,
       0);
   g.setColor(textColor);
   g.drawText(title, 5 + 20 + image.getWidth() + 20, (getHeight() - g.getFont().getHeight()) / 2);
 }
  /**
   * for drawing the Record with its Cell Title and Values
   *
   * @param graphics
   * @param b
   */
  private void drawRecord(Graphics graphics, boolean haveFocus) {
    // graphics.setColor(Color.BLACK);
    // graphics.fillRoundRect(10, 2, Display.getWidth() - 10, height + 5,
    // 10,
    // 10);
    // graphics.drawRoundRect(10, 2, Display.getWidth() - 10, height + 5,
    // 10,
    // 10);

    int color = Color.BLACK;
    int[] colors = drawFousLostColors;
    int[] X_PTS = {getWidth(), getWidth(), getPreferredWidth(), getPreferredWidth()};

    int[] Y_PTS = {height, getPreferredHeight(), getPreferredHeight(), height};
    if (haveFocus) {
      colors = drawFousGainColors;
      color = Color.WHITE;
    }
    graphics.drawShadedFilledPath(X_PTS, Y_PTS, null, colors, null);
    graphics.setColor(color);

    // for placing the arrow icon
    int image_height = (height / 2) - 8;
    int img_x_position = total_Width - 18;
    graphics.drawBitmap(
        img_x_position,
        image_height,
        arrowBitmap.getHeight(),
        arrowBitmap.getWidth(),
        arrowBitmap,
        0,
        0);

    int halfWidth = (getWidth() / 2) - RIGHT_MARGIN;

    int yPosition = 0;
    // Draw each cell

    for (int i = 0; i < record.getCells().size(); i++) {
      Cell cell = (Cell) record.getCells().elementAt(i);

      // Draw the title of the cell
      String text = cell.getTitle().trim();

      // take the value of the cell to draw
      String value = cell.getValue().trim();

      int numberOfRowsForTitle = drawText(text, value, graphics, 0, yPosition);

      int numberOfRowsForValue = drawText(value, value, graphics, halfWidth, yPosition);

      if (numberOfRowsForTitle == 1 && numberOfRowsForValue == 1) {
        yPosition += CELL_HEIGHT - MULTIPLE_CELLS;
      } else {
        yPosition += CELL_HEIGHT - MULTIPLE_CELLS;
        yPosition += SECOND_CELL_HEIGHT;
      }
    }
  }
  private void drawBitmap(Graphics gfx) {
    final int width = imageBmp.getWidth();
    final int height = imageBmp.getHeight();

    final int x = paddingLeft + ((desiredImgWidth - width) >> 1);
    final int y = paddingTop + ((desiredImgHeight - height) >> 1);

    gfx.drawBitmap(x, y, width, height, imageBmp, 0, 0);

    final int initialColor = gfx.getColor();
    gfx.setColor(Color.GRAY);
    gfx.drawRect(x, y, width, height);
    gfx.setColor(initialColor);
  }
Example #9
0
  public void drawListRow(ListField list, Graphics g, int index, int y, int w) {

    Font font = g.getFont();
    int xPos = 30;
    //		int yPos = y + (list.getRowHeight() - bit[1].getHeight()) / 2;
    int yPos = y + (list.getRowHeight() - imagee2.getHeight()) / 2;
    int yPosTxt = y + (list.getRowHeight() - font.getHeight()) / 2;

    // Bitmap imageBackground = Bitmap
    // .getBitmapResource("button_for_thumbnails_inactive.png");
    // if (list.getSelectedIndex() != index) {
    // g.drawBitmap(0, 0, 640, 80, imageBackground, 0, 0);
    // }

    if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {
      g.setBackgroundColor(0x005A6971);
      // g.drawRoundRect(0, 0, 630, 80, 15, 15);
      g.clear();
    } else {
      g.setColor(Color.WHITE);
      // g.drawRoundRect(0, 0, 630, 80, 15, 15);
    }

    //		for (int i = 0; i < bit.length; i++) {
    //			image = bit[index];
    //			g.drawBitmap(5, yPos + 3, image.getWidth(), image.getHeight(),
    //					image, 0, 0);
    //		}

    g.drawBitmap(5, yPos + 3, imagee2.getWidth(), imagee2.getHeight(), imagee2, 0, 0);

    xPos = xPos + imagee2.getWidth();
    String text = (String) listElements.elementAt(index);
    g.drawText(text, xPos, yPosTxt + 3);

    g.drawBitmap(580, yPos + 7, arrowImage.getWidth(), arrowImage.getHeight(), arrowImage, 0, 0);
  }
Example #10
0
  public static int displayHeadImage(Graphics _g, int _x, int _y, WeiboHeadImage _image) {

    if (sm_headImageMask == null) {
      if (fsm_largeHeadImage) {
        sm_headImageMask = recvMain.sm_weiboUIImage.getImageUnit("headImageMask_l");
      } else {
        sm_headImageMask = recvMain.sm_weiboUIImage.getImageUnit("headImageMask");
      }
    }

    if (_image != null) {
      _g.drawBitmap(_x, _y, fsm_headImageWidth, fsm_headImageWidth, _image.m_headImage, 0, 0);
    } else {
      try {
        _g.drawBitmap(_x, _y, fsm_headImageWidth, fsm_headImageWidth, getDefaultHeadImage(), 0, 0);
      } catch (Exception e) {
        exceptionOutput("DHI", e);
      }
    }

    recvMain.sm_weiboUIImage.drawImage(_g, sm_headImageMask, _x, _y);

    return _x + sm_headImageMask.getWidth();
  }
 private void drawChildImage(Graphics graphics, ListField listField, int index, Bitmap image) {
   if (image == null) {
     return;
   }
   try {
     graphics.drawBitmap(
         2,
         ((index) * listField.getRowHeight() + 2),
         (listField.getRowHeight() - 4),
         (listField.getRowHeight() - 4),
         image,
         0,
         0);
   } catch (NullPointerException n) {
     return;
   }
 }
  public void paint(Graphics g) {
    // Calculate the slider position
    int sliderHeight = _imageSlider.getHeight();
    int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1;

    // Determine a Background Color for the slider
    int backgroundColor = _defaultBackgroundColour;
    if (_backgroundSelectedColours != null || _backgroundColours != null) {

      if (_selected) {
        backgroundColor =
            _backgroundSelectedColours != null
                ? _backgroundSelectedColours[getState()]
                : _defaultSelectColour;
      } else if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {
        backgroundColor =
            _backgroundColours != null ? _backgroundColours[getState()] : _defaultHoverColour;
      } else {
        backgroundColor = _defaultBackgroundColour;
      }
    }
    g.setColor(backgroundColor);
    g.fillRect(1, sliderBackYOffset + 1, _totalWidth - 2, sliderHeight - 2);

    if (g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {
      paintSliderBackground(
          g, _imageSliderFocusLeft, _imageSliderFocusCenter, _imageSliderFocusRight);
    } else {
      paintSliderBackground(g, _imageSliderLeft, _imageSliderCenter, _imageSliderRight);
    }

    // Calculate the thumb position
    int thumbXOffset = ((_totalWidth - _thumbWidth) * _currentState) / _numStates;

    // Draw the thumb
    g.drawBitmap(
        thumbXOffset,
        (_totalHeight - _thumbHeight) >> 1,
        _thumbWidth,
        _thumbHeight,
        _imageThumb,
        0,
        0);
  }
  /**
   * Field implementation.
   *
   * @see net.rim.device.api.ui.Field#paint(Graphics)
   */
  protected void paint(Graphics graphics) {
    // First draw the background colour and picture

    switch (Display.getWidth()) {
      case 480:
        graphics.drawBitmap(12, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0);
        graphics.drawBitmap(167, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0);
        graphics.drawBitmap(324, 10, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0);
        graphics.setFont(font);
        graphics.setColor(Color.DARKSLATEGRAY);
        graphics.drawText(_dboc, 18, 40);
        graphics.drawText(_iboc, 173, 40);
        graphics.drawText(_tboc, 330, 40);
        break;
      case 360:
        graphics.drawBitmap(15, 10, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0);
        graphics.drawBitmap(185, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0);
        graphics.setFont(font);
        graphics.setColor(Color.DARKSLATEGRAY);
        graphics.drawText(_dboc, 28, 40);
        graphics.drawText(_iboc, 198, 40);
        graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0);
        graphics.drawText(_tboc, 130, 95);
        break;
      default:
        graphics.drawBitmap(15, 9, dbmp.getWidth(), dbmp.getHeight(), dbmp, 0, 0);
        graphics.drawBitmap(166, 10, ibmp.getWidth(), ibmp.getHeight(), ibmp, 0, 0);
        graphics.setFont(font);
        graphics.setColor(Color.DARKSLATEGRAY);
        graphics.drawText(_dboc, 18, 40);
        graphics.drawText(_iboc, 172, 40);
        graphics.drawBitmap(15, 65, tbmp.getWidth(), tbmp.getHeight(), tbmp, 0, 0);
        graphics.drawText(_tboc, 110, 95);
        break;
    }
  }
Example #14
0
 protected void paint(Graphics g) {
   int index = g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS) ? FOCUS : NORMAL;
   g.drawBitmap(
       0, 0, _bitmaps[index].getWidth(), _bitmaps[index].getHeight(), _bitmaps[index], 0, 0);
 }
  protected void paint(Graphics g) {
    int oldColor = g.getColor();
    Font oldFont = g.getFont();
    try {
      // Left Bitmap
      if (this.leftIcon != null) {
        g.drawBitmap(
            ListStyleField.HPADDING,
            ListStyleField.VPADDING,
            this.leftIcon.getWidth(),
            this.leftIcon.getHeight(),
            this.leftIcon,
            0,
            0);
      }

      // Animated Bitmap
      if (this.animate == true && this.progressBitmap != null) {
        g.drawBitmap(
            getWidth() - (this.frameWidth + ListStyleField.HPADDING),
            (getHeight() - this.actionIcon.getHeight()) / 2,
            this.frameWidth,
            this.progressBitmap.getHeight(),
            this.progressBitmap,
            this.frameWidth * this.currentFrame,
            0);
        this.currentFrame++;
        if (this.currentFrame >= this.numFrames) {
          this.currentFrame = 0;
        }
      }

      // Right (Action) Bitmap
      else if (this.actionIcon != null) {
        g.drawBitmap(
            getWidth() - (this.actionIcon.getWidth() + ListStyleField.HPADDING),
            (getHeight() - this.actionIcon.getHeight()) / 2,
            this.actionIcon.getWidth(),
            this.actionIcon.getHeight(),
            this.actionIcon,
            0,
            0);
      }

      int labelWidth = this.labelWidth;
      labelHeight = this.lableFont.getHeight();

      if (this.badgeIcon != null) {
        labelWidth -= this.badgeIcon.getWidth();
      }

      // Left Label Text
      int leftPos = this.labelLeft;
      g.setColor(this.fontColor);
      g.setFont(this.lableFont);

      if (labelWidth < this.lableFont.getAdvance(this.labelText)
          && g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) {
        int currentChar = textOffsetScalar.getInt();
        String currentText = this.labelText;
        if (currentChar < currentText.length()) {
          currentText = currentText.substring(currentChar);
        }

        if (this.lableFont.getAdvance(this.labelText) < labelWidth) {
          this.textAnimation.end(0);
        }

        g.drawText(currentText, leftPos, this.labelTop, DrawStyle.ELLIPSIS, labelWidth);
      } else {
        g.drawText(this.labelText, leftPos, this.labelTop, DrawStyle.ELLIPSIS, labelWidth);
      }
      leftPos += labelWidth;

      // Badge icon (to the left of Action bitmap)
      if (this.badgeIcon != null) {
        g.drawBitmap(
            leftPos,
            (getHeight() - this.badgeIcon.getHeight()) / 2,
            this.badgeIcon.getWidth(),
            this.badgeIcon.getHeight(),
            this.badgeIcon,
            0,
            0);
      }
    } finally {
      g.setColor(oldColor);
      g.setFont(oldFont);
    }
  }
Example #16
0
  public void drawListRow(ListField listField, Graphics g, int index, int y, int width) {
    if (isMoreButton(index)) {
      Font bold = Font.getDefault().derive(Font.BOLD);
      g.setFont(bold);
      String strMore = "More";
      int xx = (width - bold.getAdvance(strMore)) / 2;
      int yy = y + (ScheduleScreen.LIST_HEIGHT - bold.getHeight()) / 2;
      if (listField.getSelectedIndex() == index) {
        g.setColor(0);
        g.drawText(strMore, xx + 1, yy + 1);
        g.setColor(0xffffff);
        g.drawText(strMore, xx, yy);
      } else {
        g.setColor(0);
        g.drawText(strMore, xx, yy);
      }
      return;
    }
    ProgramData data = (ProgramData) listData.elementAt(index);
    //		if(!listField.isFocus() || index!=listField.getSelectedIndex()){
    //			for(int x=0; x<Display.getWidth(); x+= ScheduleScreen.LIST_BACKGROUND.getWidth())
    //				g.drawBitmap(x, y, ScheduleScreen.LIST_BACKGROUND.getWidth(),
    // ScheduleScreen.LIST_BACKGROUND.getHeight(), ScheduleScreen.LIST_BACKGROUND, 0, 0);
    //		}
    if (!listField.isFocus() || index != listField.getSelectedIndex()) {
      for (int x = 0; x < Display.getWidth(); x += ScheduleScreen.LIST_BACKGROUND.getWidth())
        g.drawBitmap(
            x,
            y,
            ScheduleScreen.LIST_BACKGROUND.getWidth(),
            ScheduleScreen.LIST_BACKGROUND.getHeight(),
            ScheduleScreen.LIST_BACKGROUND,
            0,
            0);
    }
    Bitmap thumb = TVApi.getChannelThumbnail(data.channelId);
    if (thumb != null) {
      int padding = (ScheduleScreen.LIST_HEIGHT - thumb.getHeight()) / 2;
      int ty = y + padding;
      int tx = padding;
      g.drawBitmap(tx, ty, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0);
      g.setColor(0);
      g.drawText(data.beginTime + " - " + data.endTime, tx + thumb.getWidth() + tx, ty);
      Bitmap favorite =
          data.isFavorite ? ScheduleScreen.LIST_FAVORITE_ON : ScheduleScreen.LIST_FAVORITE_OFF;
      int titleMaxWidth = width - thumb.getWidth() - favorite.getWidth() - (padding * 4);
      g.drawText(
          data.title,
          tx + thumb.getWidth() + tx,
          ty + thumb.getHeight(),
          DrawStyle.BASELINE | DrawStyle.ELLIPSIS,
          titleMaxWidth);

      g.drawBitmap(
          width - padding - favorite.getWidth(),
          y + (ScheduleScreen.LIST_HEIGHT - favorite.getHeight()) / 2,
          favorite.getWidth(),
          favorite.getHeight(),
          favorite,
          0,
          0);
    }
  }
Example #17
0
 protected void paint(Graphics graphics) {
   if (m_bitmap != null)
     graphics.drawBitmap(0, 0, getVisibleWidth(), getVisibleHeight(), m_bitmap, 0, 0);
 }
  protected void paint(Graphics g) {
    g.setColor(TITLE_COLOR);
    Font titleFont = Utils.getFontBold(FONT_SIZE);
    g.setFont(titleFont);

    int textWidht = Display.getWidth() - TEXT_ANCHOR - PADDING_RIGHT;

    if (title == null) {
      title = TextUtils.wrapText(newsItem.getTitle(), textWidht, titleFont);
    }
    int yOff = 0;
    for (int i = 0; i < title.size(); i++) {
      if (title.size() > 2 && i == 1) {
        g.drawText(
            title.elementAt(i).toString() + "...",
            TEXT_ANCHOR,
            PADDING_TOP + i * titleFont.getHeight());
        yOff += g.getFont().getHeight();
        break;
      } else {
        g.drawText(
            title.elementAt(i).toString(), TEXT_ANCHOR, PADDING_TOP + i * titleFont.getHeight());
        yOff += g.getFont().getHeight();
      }
    }

    Font textFont = Utils.getFont(FONT_SIZE);
    g.setColor(PRETEXT_COLOR);
    g.setFont(textFont);

    if (text == null) {
      text = TextUtils.wrapText(newsItem.getBody(), textWidht, textFont);
    }

    int titleHeight = PADDING_TOP + title.size() * titleFont.getHeight();
    int contentHeight = getPreferredHeight() - (PADDING_TOP);

    for (int i = 0; i < text.size(); i++) {
      if (yOff + g.getFont().getHeight() >= getPreferredHeight() - 2 * PADDING_TOP) {
        g.drawText(
            (String) text.elementAt(i) + "...",
            TEXT_ANCHOR,
            titleHeight + i * textFont.getHeight());
      } else {
        g.drawText((String) text.elementAt(i), TEXT_ANCHOR, titleHeight + i * textFont.getHeight());
      }

      yOff += g.getFont().getHeight();
      if (yOff >= getPreferredHeight() - 2 * PADDING_TOP) {
        break;
      }
    }

    if (newsImage != null) {
      try {
        g.drawBitmap(
            PADDING_LEFT,
            PADDING_TOP,
            newsImage.getWidth(),
            newsImage.getHeight(),
            newsImage,
            0,
            0);
      } catch (Exception e) {
        drawDummyPhoto(g);
      }
    } else {
      drawDummyPhoto(g);
    }
  }