Ejemplo n.º 1
0
  protected void paint(Graphics graphics) {
    //     super.paint(graphics);
    // draw and underscore
    graphics.setColor(net.rim.device.api.ui.Color.LIGHTGREY);
    graphics.setFont(Font.getDefault());

    //   graphics.drawRect(this.getFont().getAdvance(getLabel())  , 0, getWidth(), getHeight());
    graphics.drawRoundRect(
        this.getFont().getAdvance(getLabel()) + 3, 0, getWidth(), getHeight(), 5, 5);
    graphics.setColor(net.rim.device.api.ui.Color.DARKGRAY);
    graphics.drawRoundRect(
        this.getFont().getAdvance(getLabel()) + 4, 1, getWidth() - 2, getHeight() - 2, 5, 5);
    graphics.setColor(net.rim.device.api.ui.Color.BLACK);
    graphics.drawRoundRect(
        this.getFont().getAdvance(getLabel()) + 4, 1, getWidth() - 3, getHeight() - 3, 5, 5);
    String text = getText();
    String label = getLabel();
    if (label != null) {
      if (label.length() > 0) {
        graphics.drawText(label, 2, 2);
      }
      graphics.drawText(text, this.getFont().getAdvance(label) + 6, 2);
    } else {
      graphics.drawText(text, 6, 2);
    }

    if (hasFocus) {
      int x = Font.getDefault().getAdvance(getLabel()) + this.getFont().getAdvance(getText()) + 4;
      int y = Font.getDefault().getLeading();
      Font font = Font.getDefault().derive(Font.BOLD);
      graphics.setFont(font);
      graphics.drawText("|", x, y);
    }
    //   drawHighlightRegion(graphics,this.HIGHLIGHT_SELECT,true,2, 2, 2,5);

  }
  private void drawStatusBox(ListField listField, Graphics graphics, int index, Child child) {

    String childStatusString = child.childStatus().getStatusString();
    int boxHeight = getFont().getHeight() + 4;
    int boxWidth = getFont().getAdvance(childStatusString) + 4;
    int boxX = screenWidth - 10 - boxWidth;
    int boxY = ((index) * listField.getRowHeight()) + getFont().getHeight() + 2;

    graphics.setColor(child.childStatus().getStatusColor());
    graphics.drawRoundRect(boxX, boxY, boxWidth, boxHeight, 10, 10);
    graphics.fillRoundRect(boxX, boxY, boxWidth, boxHeight, 10, 10);

    graphics.setColor(16777215);
    graphics.setFont(rowFont);
    graphics.drawText(
        childStatusString,
        boxX,
        boxY + 2,
        (DrawStyle.HCENTER | DrawStyle.ELLIPSIS | DrawStyle.TOP),
        boxWidth);
  }