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);
 }
  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);
  }
Esempio n. 3
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);
  }
 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);
   }
 }
Esempio n. 5
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);
 }
Esempio n. 6
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);
  }
Esempio n. 7
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);
    }
  }