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);
  }
  public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width) {
    Object[] childImagePair = (Object[]) this.get(listField, index);
    Child child = (Child) childImagePair[0];
    Bitmap image = (Bitmap) childImagePair[1];

    drawStatusBox(listField, graphics, index, child);

    drawChildImage(graphics, listField, index, image);

    graphics.setColor(Color.BLACK);

    graphics.setFont(titleFont);

    // Takes 5 params 1:display text, 2:horizontal position,
    // 3: vertical position, 4: flags, 5: text display width
    graphics.drawText(
        (String) child.getField("name"),
        firstRowPosition,
        y,
        (DrawStyle.LEFT | DrawStyle.ELLIPSIS | DrawStyle.TOP),
        screenWidth - firstRowPosition - 4);

    int yStartForText = y + (this.getFont()).getHeight() + 1;
    drawFieldRow(graphics, width, child, yStartForText, "age");

    yStartForText = yStartForText + (this.getFont()).getHeight() + 1;
    drawFieldRow(
        graphics, width - secondRowPosition - 4, child, yStartForText, "last_known_location");

    yStartForText = yStartForText + (this.getFont()).getHeight() + 1;
    graphics.drawLine(
        0, (index * listField.getRowHeight()), width, (index * listField.getRowHeight()));
  }
 protected void paintBackground(Graphics graphics) {
   int BGR_COLOR = graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS) ? 0x000000 : 0x393939;
   graphics.setColor(BGR_COLOR);
   graphics.fillRect(0, 0, getPreferredWidth(), getPreferredHeight());
   graphics.setColor(0x000000);
   graphics.drawLine(0, getPreferredHeight() - 1, getPreferredWidth(), getPreferredHeight() - 1);
 }
示例#4
0
 protected void paintBackground(Graphics g) {
   super.paintBackground(g);
   if (myCounter % 2 == 0) {
     g.setColor(Color.WHITE);
   } else {
     g.setColor(0xf8f8f8);
   }
   g.fillRect(0, 0, getWidth(), getHeight());
   g.setColor(0xe4e3e1);
   g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1);
 }