Exemplo n.º 1
0
 @Override
 public void paint(Graphics g) {
   if (!myLookup.isFocused() && myLookup.isCompletion()) {
     ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f));
   }
   super.paint(g);
 }
 public void paint(Graphics g) {
   super.paint(g);
   if (mouseIn) {
     g.setColor(Color.blue);
     g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
   }
 }
Exemplo n.º 3
0
  public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    g2d.drawImage(img, 0, 0, null);
    g2d.drawImage(p.getImage(), p.getX(), p.getY(), null);
  }
Exemplo n.º 4
0
    @Override
    public void paint(Graphics g) {
      super.paint(g);
      if (g instanceof Graphics2D) {
        Graphics2D g2d = (Graphics2D) g;

        if (blackOutEnabled) {
          // background
          g2d.setColor(Color.BLACK);
          g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
        } else if (whiteOutEnabled) {
          // background
          g2d.setColor(Color.WHITE);
          g2d.fillRect(0, 0, this.getWidth(), this.getHeight());
        } else {
          // background
          g2d.setColor(backgroundColor);
          g2d.fillRect(0, 0, this.getWidth(), this.getHeight());

          // text
          if (font == null)
            font = GuiHelper.maxFontSize(frame.getWidth(), frame.getHeight(), fontName, timeFormat);
          if (textY == -1) textY = GuiHelper.getTextYForCenter(timeFormat, font, frame.getHeight());
          g2d.setRenderingHint(
              RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
          g2d.setFont(font);
          g2d.setColor(textColor);
          g2d.drawString(timeToString(time), 0, textY);
        }
      }
    }
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   // set where inside the dialog, the chart needs to be drawn
   Rectangle clip = new Rectangle(PAD, PAD, getWidth() - (2 * PAD), getHeight() - (2 * PAD));
   // draw the background of the chart
   drawChartBackground(g, clip);
   // set the position of the axis in case they moved
   if (yAxis.isLogScale()) {
     xAxis.setPosition(yAxis.dataValueToScreenPosition(1, clip));
   } else {
     xAxis.setPosition(yAxis.dataValueToScreenPosition(0, clip));
   }
   if (xAxis.isLogScale()) {
     yAxis.setPosition(xAxis.dataValueToScreenPosition(1, clip));
   } else {
     yAxis.setPosition(xAxis.dataValueToScreenPosition(0, clip));
   }
   // draw the grid
   xAxis.drawGrid(g, clip);
   yAxis.drawGrid(g, clip);
   // draw the curve
   drawGraphics(g, clip, chartType);
   // draw the axis
   xAxis.drawAxis(g, clip);
   yAxis.drawAxis(g, clip);
   // draw minor units
   xAxis.drawMinorUnit(g, clip);
   yAxis.drawMinorUnit(g, clip);
   // draw major units
   xAxis.drawMajorUnit(g, clip);
   yAxis.drawMajorUnit(g, clip);
   // draw the chart legend
   drawLegend(g);
 }
Exemplo n.º 6
0
    public void paint(Graphics g) {
      super.paint(g);

      Graphics2D g2d = (Graphics2D) g;

      JSPrintPreview2.this.render(g2d, -1, scale);
    }
Exemplo n.º 7
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);

    for (int i = 0; i < p.getKeys(); i++) {
      g.drawImage(keyIcon.getImage(), (i * 32) + 5, (int) (m.MAZE_SIZE + .2) * 32, null);
    }

    g.drawString("Score: " + p.getPoints(), 5, (int) ((m.MAZE_SIZE + 1.5) * 32));
    for (int i = 0; i < m.MAZE_SIZE; i++) {
      for (int j = 0; j < m.MAZE_SIZE; j++) {
        if (m.getMapTileType(j, i).equals(MazeRoomLogic.MazeEnums.RoomType.PATH)) {
          g.drawImage(m.getRoomImage(), j * 32, i * 32, null);
        }

        if (m.getMapTileType(j, i).equals(MazeRoomLogic.MazeEnums.RoomType.WALL)) {
          g.drawImage(m.getWallImage(), j * 32, i * 32, null);
        }

        if (m.getMapTileType(j, i).equals(MazeRoomLogic.MazeEnums.RoomType.DOOR)) {
          g.drawImage(m.getDoorImage(), j * 32, i * 32, null);
        }

        if (m.getMapTileType(j, i).equals(MazeRoomLogic.MazeEnums.RoomType.EXIT)) {
          g.drawImage(m.getExitImage(), j * 32, i * 32, null);
        }

        if (m.getMapTileType(j, i).equals(MazeRoomLogic.MazeEnums.RoomType.START)) {
          g.drawImage(m.getStartImage(), j * 32, i * 32, null);
        }
      }
    }

    g.drawImage(p.getPlayerImage(), p.getTileX() * 32, p.getTileY() * 32, null);
  }
Exemplo n.º 8
0
  public void paint(Graphics g) {
    super.paint(g);

    Dimension size = getSize();

    // Position of new piece on board
    int boardTop = (int) size.getHeight() - BoardHeight * squareHeight();

    for (int i = 0; i < BoardHeight; ++i) {
      for (int j = 0; j < BoardWidth; ++j) {
        Tetrominoes shape = shapeAt(j, BoardHeight - i - 1);
        if (shape != Tetrominoes.NoShape)
          drawSquare(g, 0 + j * squareWidth(), boardTop + i * squareHeight(), shape);
      }
    }

    if (curPiece.getShape() != Tetrominoes.NoShape) {
      for (int i = 0; i < 4; ++i) {
        int x = curX + curPiece.x(i);
        int y = curY - curPiece.y(i);
        drawSquare(
            g,
            0 + x * squareWidth(),
            boardTop + (BoardHeight - y - 1) * squareHeight(),
            curPiece.getShape());
      }
    }
  }
 @Override
 public void paint(Graphics g) {
   paintHighlight(g);
   super.paint(g);
   paintGlyph(g);
   paintStone(g);
 }
Exemplo n.º 10
0
 public void paint(Graphics g) {
   super.paint(g);
   drawAxis(
       Axis.X_AXIS,
       10,
       5,
       curLowVal,
       curHighVal,
       50,
       getWidth() - 50,
       50,
       logScale,
       getHeight(),
       g);
   drawAxis(
       Axis.Y_AXIS,
       10,
       5,
       curLowVal,
       curHighVal,
       50,
       getHeight() - 50,
       50,
       logScale,
       getHeight(),
       g);
   g.drawString("Current Slider Range: " + curLowVal + " --> " + curHighVal, 10, 20);
 }
Exemplo n.º 11
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);

    drawBordered(
        g,
        getTrackBounds(0.0, 1.0),
        getBackground().darker().darker(),
        getBackground().darker(),
        getBackground().brighter());
    drawBordered(
        g,
        getTrackBounds(lowSliderPosition, highSliderPosition),
        getForeground().darker(),
        getBackground().darker(),
        getBackground().brighter());
    drawBordered(
        g,
        getButtonBounds(lowSliderPosition, false),
        getForeground(),
        getForeground().brighter(),
        getForeground().darker());
    drawBordered(
        g,
        getButtonBounds(highSliderPosition, true),
        getForeground(),
        getForeground().brighter(),
        getForeground().darker());
  }
    /** {@inheritDoc} */
    @SuppressWarnings("synthetic-access")
    @Override
    public synchronized void paint(Graphics g) {

      Dimension viewport = getSize();

      int size = Math.min(viewport.width, viewport.height) - 30;

      int columnSize = Math.max((viewport.width - 10) / CubeWorldPanel.this.cubeCount, 10);
      int cubeSize = Math.max(Math.min(columnSize, size / CubeWorldPanel.this.cubeCount) - 5, 5);
      int base = viewport.height - 20;

      State currentState = getCurrentState();

      // Draw warning background
      Color bg = getBackground();
      if (currentState != null && currentState.isInconsistent) {
        setBackground(Color.ORANGE);
      }
      super.paint(g);
      setBackground(bg);

      // Draw table
      g.setColor(Color.DARK_GRAY);
      g.fillRect(0, base, viewport.width, 20);

      // Draw cubes
      if (currentState != null) {
        int x = 5 + (columnSize - cubeSize) / 2;
        for (EcoIdentity onGround : currentState.onGround) {
          drawColumn(g, currentState, onGround, x, base, cubeSize);
          x += columnSize;
        }
      }
    }
Exemplo n.º 13
0
  public void paint(Graphics g) {
    // clear field
    super.paint(g);

    // draw grid lines
    g.setColor(Color.DARK_GRAY);
    gridXIter = gridX.listIterator();
    while (gridXIter.hasNext()) {
      int x = gridXIter.next();
      g.drawLine(x, 0, x, getHeight());
    }
    gridYIter = gridY.listIterator();
    while (gridYIter.hasNext()) {
      int y = gridYIter.next();
      g.drawLine(0, y, getWidth(), y);
    }

    // draw objects
    ListIterator<PhysicsObject> iter = Universe.allObjects.listIterator();
    while (iter.hasNext()) {
      PhysicsObject obj = iter.next();
      int x = (int) (obj.getX() * pixelsPerMeter + origin.x);
      int y = (int) (obj.getY() * pixelsPerMeter + origin.y);
      g.fillOval(x - 5, y - 5, 10, 10); // TODO update for non-point objects
    }
  }
Exemplo n.º 14
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);

    Dimension d = this.getSize();
    if (!isEmpty()) {
      int nbOfCards = cards.size();
      int removal = 0;
      if ((nbOfCards * maxCardWidth) > d.getWidth() && nbOfCards != 1) {
        removal = (int) (((nbOfCards * maxCardWidth) - d.getWidth()) / (nbOfCards - 1));
        if (removal > (nbOfCards - 1) * maxCardWidth) {
          removal = (nbOfCards - 1) * maxCardWidth;
        }
      }

      int height = maxCardHeight;
      if (d.getHeight() < maxCardHeight) {
        height = (int) d.getHeight();
      }

      int currentX = 0;
      int i = 0;
      for (Image img : images) {
        g.drawImage(img, currentX - (i * removal), 0, maxCardWidth, height, null);
        currentX += maxCardWidth;
        i++;
      }
    }
  }
Exemplo n.º 15
0
    public void paint(Graphics g) {

      super.paint(g);
      int squareWidth = (int) getSize().getWidth() / model.getWidth();
      int squareHeight = (int) getSize().getHeight() / model.getHeight();
      int boardTop = (int) getHeight() - model.getHeight() * squareHeight;

      for (int i = 0; i < model.getHeight(); ++i) {
        for (int j = 0; j < model.getWidth(); ++j) {
          Tetrominoes shape = model.shapeAt(j, model.getHeight() - i - 1);
          if (shape != Tetrominoes.NoShape)
            drawSquare(g, 0 + j * squareWidth, boardTop + i * squareHeight, shape);
        }
      }

      if (model.currPieceShape() != Tetrominoes.NoShape) {
        for (int i = 0; i < 4; ++i) {
          int x = model.getCurrX() + model.curPiece.x(i);
          int y = model.getCurrY() - model.curPiece.y(i);
          drawSquare(
              g,
              0 + x * squareWidth,
              boardTop + (model.getHeight() - y - 1) * squareHeight,
              model.currPieceShape());
        }
      }
    }
Exemplo n.º 16
0
  @Override
  public void paint(Graphics g) {
    // init the paint
    super.paint(g);
    // cast g to a Graphics2D object so we can use its features
    Graphics2D g2 = (Graphics2D) g;
    // get a rendering hints object. not sure why.
    RenderingHints rh =
        new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    // pass it some parameters
    rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    // connect rh to the graphics object
    g2.setRenderingHints(rh);

    /** Lookup Table for which color to be 0 = dead, white 1 = alive, black */
    Color[] lookup = {Color.white, Color.black};

    int x, y, state;
    for (x = 0; x < sizex; x++) {
      for (y = 0; y < sizey; y++) {
        state = uni.getState(x, y);
        g2.setColor(lookup[state]);
        g2.fillRect(scale * x, scale * y, scale, scale);
      }
    }
  }
Exemplo n.º 17
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);
    connectUsers("Select * from users");
    CustomButton.setGraphics(g);
    ScaledPoint.setWindowDimensions(getWidth(), getHeight());

    if (help) // display help message
    {
      showHelp(g);
      return;
    }

    // Draw main GUI components
    drawStoreBG(g);
    drawStoreName(g);
    drawStoreImage(g);
    drawStoreMessage(g);
    drawInventory(g);
    drawBalance(g);
    drawPageIndicator(g);

    deactivateButtons();
    CustomButton.draw();
  }
Exemplo n.º 18
0
  @Override
  public void paint(Graphics g) {

    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    if (metrics == null) {
      metrics = g2d.getFontMetrics(font);
      width = this.getWidth();
      height = this.getHeight();
      playerHealthPosX = width - healthbarWidth - 30;
    }

    g2d.setColor(new Color(255, 0, 0));
    g2d.fillRect(30, 0, (int) (healthOwnerM * healthbarWidth), height);

    if (isMultiplayer) {
      int hToSub = (int) ((1 - healthPlayerM) * healthbarWidth);
      g2d.fillRect(playerHealthPosX + hToSub, 0, healthbarWidth - hToSub, height);
    }
    g2d.setColor(new Color(0, 0, 0));
    g2d.setFont(font);
    g2d.drawString(pointsOwner, ownerStringPosX, stringHeight);
    if (isMultiplayer) {
      playerStringPosX = width - healthbarWidth - 35 - metrics.stringWidth(pointsPlayer);
      g2d.drawString(pointsPlayer, playerStringPosX, stringHeight);
    }
  }
 @Override
 public void paint(Graphics g) {
   // Aktualisiere die Label-Texte abhängig vom aktuellen Thread-Status
   labelStatus.setText(this.running ? "LÄUFT" : "WARTET");
   labelStatus.setForeground(this.running ? Color.blue : Color.gray);
   labelInterval.setText(String.format("Intervall: %d ms", t.getInterval()));
   super.paint(g);
 }
Exemplo n.º 20
0
 public void paint(Graphics g) {
   Graphics2D g2d = (Graphics2D) g;
   Composite oldComp = g2d.getComposite();
   Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha);
   g2d.setComposite(alphaComp);
   super.paint(g2d);
   g2d.setComposite(oldComp);
 }
Exemplo n.º 21
0
  @Override
  public void paint(Graphics g) {
    super.paint(g);

    drawBack(g);
    drawFangkuai(g, curt_xingzhuang);
    moveDown(curt_xingzhuang);
  }
Exemplo n.º 22
0
    /** paint class for drawing rectangles */
    public void paint(Graphics g) {

      // call superclass
      super.paint(g);

      // draw Fractal
      drawFractal(g, point, level, width, height);
    }
Exemplo n.º 23
0
  public void paint(Graphics g) {
    super.paint(g);

    Dimension size = getSize();
    double w = size.getWidth() - 50;
    double h = size.getHeight() + 20;

    try {
      readFile();
    } catch (IOException e) {
      System.err.println("IO issue");
    }

    barWidth = ((int) (w / numBars)) - 20;
    pos = 5;

    int xPos[] = {pos, pos, pos, pos};
    int yPos[] = {pos, pos, pos, pos};

    maxVal = maxValue(values);
    double barH, ratio;

    for (int i = 0; i < numBars - 1; i++) {
      Color col[] = new Color[numBars];
      for (int j = 0; j < numBars - 1; j++) {
        col[j] = new Color((int) (Math.random() * 0x1000000));
      }

      ratio = (double) values[i] / (double) maxVal;
      barH = ((h) * ratio) - 10;

      xPos[0] = pos;
      xPos[2] = pos + barWidth;
      xPos[1] = xPos[0];
      xPos[3] = xPos[2];
      yPos[0] = (int) h;
      yPos[1] = (int) barH;
      yPos[2] = yPos[1];
      yPos[3] = yPos[0];

      System.out.println(
          "xPos:" + xPos[1] + " yPos:" + yPos[0] + " h:" + h + " barH:" + barH + " ratio:" + ratio
              + " pos:" + pos);

      int stringPtsY[] = {
        ((i + 1) * 20) + 180, ((i + 1) * 20) + 200, ((i + 1) * 20) + 200, ((i + 1) * 20) + 180
      };
      int stringPtsX[] = {600, 600, 580, 580};

      g.setColor(col[i]);
      g.fillPolygon(xPos, yPos, xPos.length);

      g.fillPolygon(stringPtsX, stringPtsY, 4);
      g.setColor(Color.black);
      g.drawString(labels[i], 610, ((i + 1) * 20) + 195);
      pos = pos + barWidth + 10;
    }
  }
Exemplo n.º 24
0
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   for (Ball b : ballsList) {
     g.setColor(b.getColor());
     g.fillOval(b.getX(), b.getY(), b.getSize(), b.getSize());
     b.move(getWidth(), getHeight());
   }
 }
Exemplo n.º 25
0
        @Override
        public void paint(Graphics g) {
          Graphics2D g2 = (Graphics2D) g;
          g2.setPaint(
              new GradientPaint(0, 0, NuclosThemeSettings.BACKGROUND_PANEL, 0, FADE, Color.WHITE));
          g2.fillRect(0, 0, getWidth(), getHeight());

          super.paint(g);
        }
Exemplo n.º 26
0
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   g.setColor(Color.BLACK);
   g.fillRect(0, 0, Ballz.FRAME_WIDTH, Ballz.FRAME_HEIGHT);
   for (Ball e : balls) {
     e.paint(g);
   }
 }
Exemplo n.º 27
0
  public void paint(Graphics g) {
    super.paint(g);

    Graphics2D g2d = (Graphics2D) g;
    g2d.fillRect(0, 0, width, height);

    Toolkit.getDefaultToolkit().sync();
    g.dispose();
  }
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   if (myTextField.isFocusOwner() || (getPopup() != null && getPopup().isPopupVisible())) {
     if (isUsingDarculaUIFlavor()) {
       DarculaUIUtil.paintFocusRing(g, 3, 3, getWidth() - 4, getHeight() - 4);
     }
   }
 }
Exemplo n.º 29
0
  public void paint(Graphics g) {
    super.paint(g);

    Graphics2D g2 = (Graphics2D) g;
    int size =
        Math.min(
            MAX_SIZE,
            Math.min(
                getWidth() - imagePadding.left - imagePadding.right,
                getHeight() - imagePadding.top - imagePadding.bottom));

    g2.translate(getWidth() / 2 - size / 2, getHeight() / 2 - size / 2);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    Shape shape;

    if (mode == ColorPicker.SAT || mode == ColorPicker.BRI) {
      shape = new Ellipse2D.Float(0, 0, size, size);
    } else {
      Rectangle r = new Rectangle(0, 0, size, size);
      shape = r;
    }

    if (hasFocus()) {
      PaintUtils.paintFocus(g2, shape, 5);
    }

    if (!(shape instanceof Rectangle)) {
      // paint a circular shadow
      g2.translate(2, 2);
      g2.setColor(new Color(0, 0, 0, 20));
      g2.fill(new Ellipse2D.Float(-2, -2, size + 4, size + 4));
      g2.setColor(new Color(0, 0, 0, 40));
      g2.fill(new Ellipse2D.Float(-1, -1, size + 2, size + 2));
      g2.setColor(new Color(0, 0, 0, 80));
      g2.fill(new Ellipse2D.Float(0, 0, size, size));
      g2.translate(-2, -2);
    }

    g2.drawImage(image, 0, 0, size, size, 0, 0, size, size, null);

    if (shape instanceof Rectangle) {
      Rectangle r = (Rectangle) shape;
      PaintUtils.drawBevel(g2, r);
    } else {
      g2.setColor(new Color(0, 0, 0, 120));
      g2.draw(shape);
    }

    g2.setColor(Color.white);
    g2.setStroke(new BasicStroke(1));
    g2.draw(new Ellipse2D.Float(point.x - 3, point.y - 3, 6, 6));
    g2.setColor(Color.black);
    g2.draw(new Ellipse2D.Float(point.x - 4, point.y - 4, 8, 8));

    g.translate(-imagePadding.left, -imagePadding.top);
  }
 @Override
 public void paint(Graphics g) {
   super.paint(g);
   paintLines((Graphics2D) g);
   paintTurtle((Graphics2D) g);
   for (Paintable p : additional) {
     p.paint((Graphics2D) g);
   }
 }