protected void paintBackground(Graphics gfx) {
   if (drawBtnStyle) {
     gfx.setBackgroundColor(Color.BLACK);
     gfx.clear();
   }
   super.paintBackground(gfx);
 }
  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()));
  }
  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
  }
 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);
 }
  private int drawText(String text, String value, Graphics graphics, int xPosition, int yPosition) {

    if (text.trim().length() == 0) {
      return 1;
    }
    int halfWidth = 0;
    if (value.trim().length() == 0) { // if value contains no text, then
      // display title in complete width
      halfWidth = total_Width - RIGHT_MARGIN;
    } else {
      // if value contains text, then display title in half width
      halfWidth = (total_Width / 2) - RIGHT_MARGIN;
    }

    int index = getIndexEnoughToFitIn(text, halfWidth);
    String firstHalf = text.substring(0, index);

    graphics.drawText(firstHalf, xPosition + LEFT_MARGIN, yPosition + TOP_MARGIN);

    // Check if we have more to draw
    if (index < text.length()) {
      String secondHalf = text.substring(index);
      graphics.drawText(
          secondHalf, xPosition + LEFT_MARGIN, yPosition + SECOND_CELL_HEIGHT + TOP_MARGIN);
      return 2;
    } else {
      return 1;
    }
  }
  /**
   * 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;
      }
    }
  }
  // #ifdef VER_4.5.0
  public void paint(Graphics g) {

    int oldColor = g.getColor();
    g.setColor(0x00000000);
    g.drawRect(0, 0, getWidth() + 1, getHeight() + 1);
    g.setColor(oldColor);
    super.paint(g);
  }
 public void paint(Graphics graphics) {
   // Sets the BackgroundColor
   graphics.setBackgroundColor(Color.BLACK);
   graphics.setColor(Color.WHITESMOKE);
   graphics.drawText("Black", 0, 10);
   // Clears the entire graphic area to the current background
   graphics.clear();
 }
 public void paint(Graphics g) {
   int xPts[] = {0, 0, getPreferredWidth(), getPreferredWidth()};
   int yPts[] = {0, getPreferredHeight(), getPreferredHeight(), 0};
   g.setColor(3947580);
   g.drawFilledPath(xPts, yPts, null, null);
   // g.drawTexturedPath(xPts,yPts,null,null,0,0,Fixed32.ONE,0,0,Fixed32.ONE,img);
   super.paint(g);
 }
Example #10
0
  protected void paint(Graphics g) {
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, userField.getWidth() + 8, userImage.getHeight());

    g.setColor(Color.GRAY);
    g.drawRect(0, 0, userField.getWidth() + 8, userImage.getHeight());

    super.paint(g);
  }
 protected void paintBackground(Graphics g) {
   int oldColor = g.getColor();
   try {
     g.setColor(0xFFFFFF);
     g.fillRect(0, getVerticalScroll(), getWidth(), getHeight());
   } finally {
     g.setColor(oldColor);
   }
 }
 protected void drawFocus(Graphics gfx, boolean on) {
   // we don't call super.drawFocus(), completely overriding native behavior,
   // otherwise some devices (e.g. Storm) draw some native focus graphics
   // that looks a bit ugly for us
   if (on) {
     gfx.setBackgroundColor(0x005DE7);
     gfx.clear();
     paint(gfx);
   }
 }
 private void drawFieldRow(
     Graphics graphics, int width, Child child, int yStartForText, String field) {
   graphics.setFont(rowFont);
   graphics.drawText(
       (String) child.getField(field),
       secondRowPosition,
       yStartForText,
       (DrawStyle.LEFT | DrawStyle.ELLIPSIS | DrawStyle.TOP),
       width);
 }
Example #14
0
 public void drawListRow(ListField listField, Graphics g, int index, int y, int w) {
   String sColapsado = "";
   Item item = (Item) get(listField, index);
   if (listField.getSelectedIndex() == index) {
     g.setColor(Color.WHITE);
     g.setBackgroundColor(Estilos.getBGSelected());
   } else {
     if (item.isCabecera()) {
       g.setColor(Estilos.getColorInterlinea(0));
       g.setBackgroundColor(Estilos.getBGInterlinea(0));
     } else {
       g.setColor(Estilos.getColorInterlinea(1));
       g.setBackgroundColor(Estilos.getBGInterlinea(1));
     }
     g.clear();
   }
   if (item.isCabecera()) {
     if (item.isColapsado()) {
       sColapsado = Characters.BLACK_RIGHT_POINTING_TRIANGLE + " ";
     } else {
       sColapsado = Characters.BLACK_DOWN_POINTING_TRIANGLE + " ";
     }
   } else {
     sColapsado = Characters.SPACE + "";
   }
   g.drawText(sColapsado + item.getDescripcion(), 0, y, DrawStyle.LEFT, w);
   g.drawText(item.getValor(), 0, y, DrawStyle.RIGHT, w);
 }
  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 drawFocus(Graphics g, boolean on) {
   boolean oldDrawStyleFocus = g.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS);
   try {
     if (on) {
       g.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, true);
     }
     paint(g);
   } finally {
     g.setDrawingStyle(Graphics.DRAWSTYLE_FOCUS, oldDrawStyleFocus);
   }
 }
Example #17
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);
 }
Example #18
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 #19
0
 public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
   if (list.getSelectedIndex() == index) {
   } else {
     g.setColor(Color.WHITE);
     if (get(index).equals("Consultoras") || get(index).equals("Pedidos")) {
       g.setBackgroundColor(Estilos.getBGModulo());
     } else {
       g.setBackgroundColor(Estilos.getBGSubModulo());
     }
     g.clear();
   }
   g.drawText(get(index), 0, y, 0, w);
 }
  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);
  }
  private void drawError(Graphics gfx, int fontHeight) {
    errorLoadingHeight = fontHeight;
    errorLoadingWidth = w - totalPaddingX;

    final int initialColor = gfx.getColor();
    if (drawBtnStyle) {
      gfx.setColor(Graphics.WHITE);
    }

    gfx.drawText(
        ERROR_LABEL,
        paddingLeft,
        ((h - labelToImageGap - labelHeight - errorLoadingHeight - paddingBottom) >> 1),
        (DrawStyle.ELLIPSIS | DrawStyle.HCENTER),
        errorLoadingWidth);

    gfx.setColor(initialColor);
  }
  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);
  }
  private void drawLabel(Graphics gfx, int fontHeight) {
    labelHeight = fontHeight;
    labelWidth = w - totalPaddingX;

    final int initialColor = gfx.getColor();

    if (drawBtnStyle) {
      gfx.setColor(Graphics.WHITE);
    }

    gfx.drawText(
        label,
        paddingLeft,
        (h - labelHeight - paddingBottom),
        (DrawStyle.ELLIPSIS | DrawStyle.HCENTER),
        labelWidth);

    gfx.setColor(initialColor);
  }
Example #24
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();
  }
  protected void paint(Graphics graphics) {
    super.paint(graphics);

    if (currentFrame != 0) {
      graphics.drawImage(
          image.getFrameLeft(currentFrame),
          image.getFrameTop(currentFrame),
          image.getFrameWidth(currentFrame),
          image.getFrameHeight(currentFrame),
          image,
          currentFrame,
          0,
          0);
    }
  }
 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;
   }
 }
  private void drawDummyPhoto(Graphics graphics) {
    graphics.setColor(0xcccccc);
    int w = TEXT_ANCHOR - 2 * PADDING_TOP;
    graphics.fillRoundRect(PADDING_LEFT, PADDING_TOP, w, w, 10, 10);

    graphics.setFont(Utils.getFont(5));
    graphics.setColor(0x999999);
    graphics.drawText(
        "NO PHOTO",
        (TEXT_ANCHOR - graphics.getFont().getAdvance("NO PHOTO")) / 2,
        (TEXT_ANCHOR - graphics.getFont().getHeight()) / 2);
  }
Example #28
0
  public EditorScreen(final Bitmap gbr, String path, String filename) {
    super(NO_VERTICAL_SCROLL);
    this.path = path;
    this.filename = filename;
    this.gbr = gbr;
    this.g = Graphics.create(gbr);

    UiApplication.getUiApplication().requestForeground();

    latar =
        new VerticalFieldManager(
            VERTICAL_SCROLL | HORIZONTAL_SCROLL | USE_ALL_WIDTH | USE_ALL_HEIGHT) {
          protected void paint(Graphics graphics) {
            graphics.drawBitmap(0, 0, gbr.getWidth(), gbr.getHeight(), gbr, 0, 0);
            graphics.drawRect(0, 0, gbr.getWidth(), gbr.getHeight());
            super.paint(graphics);
          }
        };

    this.gbrfield = new gbrField(gbr.getWidth(), gbr.getHeight());
    latar.add(gbrfield);
    gbrfield.setText("Jalak_Harupat");
    add(latar);

    addMenuItem(addText);
    addMenuItem(addArrow);
    addMenuItem(addimg);
    addMenuItem(addFilter);
    addMenuItem(addhelp);
    addMenuItem(saveclose);
    addMenuItem(about);
    if (DBStor.getSettings() == null) {
      UiApplication.getUiApplication()
          .invokeLater(
              new Runnable() {
                public void run() {
                  Dialog.alert("this is editor Screen, Click menu to do something.");
                }
              });
      DBStor.setSettings(new Settings());
    }
    setDirty(true);
  }
  protected void paint(Graphics graphics) {
    // Call super.paint. This will draw the first background
    // frame and handle any required focus drawing.
    super.paint(graphics);

    // Don't redraw the background if this is the first frame.
    if (_currentFrame != 0) {
      // Draw the animation frame.
      graphics.drawImage(
          _image.getFrameLeft(_currentFrame),
          _image.getFrameTop(_currentFrame),
          _image.getFrameWidth(_currentFrame),
          _image.getFrameHeight(_currentFrame),
          _image,
          _currentFrame,
          0,
          0);
    }
  }
  protected void paint(Graphics gfx) {
    // Logger.debug(this, "paint: entered for '" + label + '\'');

    final int fontHeight = gfx.getFont().getHeight();

    if (label != null) {
      drawLabel(gfx, fontHeight);
    }

    if (imgUrl != null) {

      if (imageBmp != null) {
        drawBitmap(gfx);

      } else {

        if (errorLoadingImage) {
          drawError(gfx, fontHeight);

        } else {
          if (!isLoadingImage) {
            desiredImgHeight = h - labelToImageGap - labelHeight - totalPaddingY;
            desiredImgWidth = w - totalPaddingX;
            isLoadingImage = true;

            BitmapLoader.requestLoading(bitmapLoading);
          }

          if (isLoadingImage) {
            drawLoading(gfx, fontHeight);
          }
        }
      }
    }

    if (drawBtnStyle) {
      drawBtnStyle(gfx);
    }
    // Logger.debug(this, "paint: passed");
  }