// }
 public void drawCursor(Graphics g, int width, int height) {
   int x = xCursor * imgWidth;
   g.setColor(ColorScheme.LIST_BGND);
   g.fillRect(0, 0, width, height);
   g.translate(x, 0);
   super.drawCursor(g, imgWidth, lineHeight);
   g.translate(-x, 0);
 }
Ejemplo n.º 2
0
 /** ********************************************************************** */
 public void paintComponent(Graphics g) {
   for (int i = 0; i < model.size(); i++) {
     int y = i * cell_height;
     if (y + cell_height < g.getClipY()) continue;
     else if (y > g.getClipY() + g.getClipHeight()) break;
     //
     g.translate(0, y);
     IComponent c =
         renderer.getListCellRendererComponent(
             this, model.elementAt(i), i, selection.isSelectedIndex(i), (rollover == i));
     c.setBounds(0, 0, bounds.width, cell_height);
     c.setFont(font);
     c.setEnabled(enabled);
     c.paint(g);
     g.translate(0, -y);
   }
 }
Ejemplo n.º 3
0
  /**
   * Second Pass: We sweep through the layers from the bottom to the top and paint each one that is
   * marked as dirty
   *
   * <p>Note, that the painting for copied layers is done here to not hold the layers lock during
   * the painting.
   *
   * @param g The graphics object to use to paint this window.
   * @param refreshQ The custom queue which holds the set of refresh regions needing to be blitted
   *     to the screen
   */
  private void paintLayers(Graphics g, CGraphicsQ refreshQ) {
    if (CGraphicsQ.DEBUG) {
      System.err.println("[Paint dirty layers]");
    }

    for (int i = 0; i < dirtyCount; i++) {
      CLayer l = dirtyLayers[i];

      // Prepare relative dirty region coordinates
      // of the current layer
      int dx = l.dirtyBoundsCopy[X];
      int dy = l.dirtyBoundsCopy[Y];
      int dw = l.dirtyBoundsCopy[W];
      int dh = l.dirtyBoundsCopy[H];

      // Before we call into the layer to paint, we
      // translate the graphics context into the layer's
      // coordinate space
      g.translate(l.boundsCopy[X], l.boundsCopy[Y]);

      if (CGraphicsQ.DEBUG) {
        System.err.println("Painting Layer: " + l);
        System.err.println("\tClip: " + dx + ", " + dy + ", " + dw + ", " + dh);
      }

      // Clip the graphics to only contain the dirty region of
      // the layer (if the dirty region isn't set, clip to the
      // whole layer contents).
      g.clipRect(dx, dy, dw, dh);
      refreshQ.queueRefresh(l.boundsCopy[X] + dx, l.boundsCopy[Y] + dy, dw, dh);
      l.paint(g);

      // We restore our graphics context to prepare
      // for the next layer
      g.translate(-g.getTranslateX(), -g.getTranslateY());
      g.translate(tranX, tranY);

      // We reset our clip to this window's bounds again.
      g.setClip(bounds[X], bounds[Y], bounds[W], bounds[H]);

      g.setFont(font);
      g.setColor(color);
    } // for
  }
  public void paintAnimation(int x, int y, Displayable displayable, Image image, Graphics g) {
    // draw next as image
    g.drawImage(image, 0, 0, Graphics.TOP | Graphics.LEFT);

    // draw last as a translated screen
    Screen screen = (Screen) displayable;

    // #if polish.css.repaint-previous-screen
    this.overlay.paint(0, 0, this.screenWidth, this.screenHeight, g);
    screen.repaintPreviousScreen = false;
    // #endif

    g.translate(0, this.screenHeight - this.currentY);
    screen.paint(g);
    g.translate(0, -g.getTranslateY());

    // #if polish.css.repaint-previous-screen
    screen.repaintPreviousScreen = true;
    // #endif
  }
 protected void drawBalloon(final Graphics g, int balloon, final String text) {
   if (cursor == 0) balloon += lineHeight + Balloon.getHeight();
   int x = xCursor * imgWidth;
   g.translate(x, balloon);
   Balloon.draw(g, text);
 }
Ejemplo n.º 6
0
  public void paint(Graphics g) {
    g.setFont(inputFont);
    g.setColor(0xffffff);
    g.fillRect(0, 0, getWidth(), getHeight());
    g.setColor(0x000000);

    int x = getCursorX();
    int y = getCursorY();

    translationX = caretLeft - (getWidth() - 5);

    // if(isUp)
    // {
    translationY = y * inputHeight - (getHeight() - 40);
    // }
    // else if(isDown)
    // {
    // 	translationY = y*inputHeight - (getHeight() - 40);
    // }
    // etc

    if (translationX > 0) {
      g.translate(-translationX, 0);
    }

    if (translationY > 0) {
      g.translate(0, -translationY);

      displayLines(g, y - linesOnScreen);
    } else {
      displayLines(g, 0);
    }

    if (caretBlinkOn && goToNextChar) {
      displayCursor(g);
    }

    if (translationX > 0) {
      g.translate(translationX, 0);
    }

    if (translationY > 0) {
      g.translate(0, translationY);
    }

    if (currentState == EditorState.Commands) {
      if (!goToNextChar) {
        displayCharacterMap(g);
      } else {
        displayCurrentCommand(g);
      }
    } else if (currentState == EditorState.Input) {
      if (!goToNextChar) {
        displayCharacterMap(g);
      } else if (isViewStatus) {
        displayStatus(g);
      }
    }

    if (isViewScrollBar) {
      displayScrollBar(g);
    }
  }