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); } }