synchronized void drawCurrentFrame(Graphics g) {
   // Called to draw the current frame.  But it is not drawn during
   // the animation of the solution.  During the animation, the
   // moveDisk() method just modifies the existing picture.
   g.setColor(BACKGROUND_COLOR);
   g.fillRect(0, 0, 430, 143);
   g.setColor(BORDER_COLOR);
   g.drawRect(0, 0, 429, 142);
   g.drawRect(1, 1, 427, 140);
   if (tower == null) return;
   g.fillRect(10, 128, 130, 5);
   g.fillRect(150, 128, 130, 5);
   g.fillRect(290, 128, 130, 5);
   g.setColor(DISK_COLOR);
   for (int t = 0; t < 3; t++) {
     for (int i = 0; i < towerHeight[t]; i++) {
       int disk = tower[t][i];
       g.fillRoundRect(75 + 140 * t - 5 * disk - 5, 116 - 12 * i, 10 * disk + 10, 10, 10, 10);
     }
   }
   if (moveDisk > 0) {
     g.setColor(MOVE_DISK_COLOR);
     g.fillRoundRect(
         75 + 140 * moveTower - 5 * moveDisk - 5,
         116 - 12 * towerHeight[moveTower],
         10 * moveDisk + 10,
         10,
         10,
         10);
   }
 }
Example #2
0
  /** Overrides <code>Graphics.fillRoundRect</code>. */
  public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info()
          .log(
              toShortString()
                  + " Filling round rect: "
                  + new Rectangle(x, y, width, height)
                  + " arcWidth: "
                  + arcWidth
                  + " archHeight: "
                  + arcHeight);
    }
    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.fillRoundRect(x, y, width, height, arcWidth, arcHeight);
  }
Example #3
0
  public void paint(Graphics g) {
    if (!gameComplete) {
      if (!initialPaintComplete) {
        g.setColor(Color.WHITE);
        g.fillRect(0, 0, MaxX, MaxY);
        initialPaintComplete = true;
      }

      Graphics blockGraphics = blockBuffer.getGraphics();
      Graphics padGraphics = padBuffer.getGraphics();
      Graphics ballGraphics = ballBuffer.getGraphics();
      Graphics ballPreviousGraphics = ballBufferPrevious.getGraphics();

      ballPreviousGraphics.setColor(Color.WHITE);
      ballPreviousGraphics.fillRect(0, 0, ballDiameter, ballDiameter);
      g.drawImage(ballBufferPrevious, ballPreviousX, ballPreviousY, null);

      ballGraphics.setColor(Color.BLUE);
      ballGraphics.fillOval(0, 0, ballDiameter, ballDiameter); // whole line white
      g.drawImage(ballBuffer, ballX, ballY, null);

      ballGraphics.setColor(Color.RED);
      ballGraphics.fillOval(4, 4, ballDiameter - 8, ballDiameter - 8); // whole line white
      g.drawImage(ballBuffer, ballX, ballY, null);

      padGraphics.setColor(Color.WHITE);
      padGraphics.fillRect(0, 0, MaxX, blockHeight); // whole line white
      padGraphics.setColor(Color.BLACK);
      padLeft = padx - padLength / 2;

      if (padLeft >= 0 && padx + padLength / 2 < MaxX) {
        padGraphics.fillRoundRect(padLeft, 0, padLength, padHeight, padHeight, padHeight);
      }
      if (padLeft < 0) {
        padGraphics.fillRoundRect(0, 0, padLength, padHeight, padHeight, padHeight);
      } else if (padx + padLength / 2 >= MaxX) {
        padGraphics.fillRoundRect(MaxX - padLength, 0, padLength, padHeight, padHeight, padHeight);
      }
      g.drawImage(padBuffer, 0, padTop, null);
      // g.drawString(msg, 50, 50);
      // Drawing Blocks

      Iterator<Entry<String, Color>> it = blockMap.entrySet().iterator();
      blockGraphics.setColor(Color.WHITE);
      blockGraphics.fillRect(0, 0, blockSetWidth, blockSetHeight); // whole line white
      while (it.hasNext()) {
        Map.Entry<String, Color> pairs = (Map.Entry<String, Color>) it.next();
        String coordinate = pairs.getKey();
        blockGraphics.setColor(pairs.getValue());
        blockGraphics.fillRect(
            new Pair(coordinate).first, new Pair(coordinate).second, blockLength, blockHeight);
      }
      if (repaintBlocks) {
        g.drawImage(blockBuffer, blockStartX, blockStartY, null);
        if (--count < 0) repaintBlocks = false;
      }
    }
  }
Example #4
0
  /** PaintComponent to draw everything. */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.WHITE);
    // If using images, use cool dragon background
    if (useImages) g.drawImage(background, 0, 0, 310, 300, null);

    // Use light gray to not overpower the background image
    g.setColor(Color.LIGHT_GRAY);
    for (int y = 1; y < ROWS; ++y)
      g.fillRoundRect(0, cellSize * y - 4, (cellSize * COLS) - 1, 8, 8, 8);
    for (int x = 1; x < COLS; ++x)
      g.fillRoundRect(cellSize * x - 4, 0, 8, (cellSize * ROWS) - 1, 8, 8);

    // Use graphics2d for when not using the images
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (int y = 0; y < ROWS; ++y) {
      for (int x = 0; x < COLS; ++x) {
        int x1 = x * cellSize + 16;
        int y1 = y * cellSize + 16;
        if (board[y][x] == Symbol.X) {
          // use image if set to true, otherwise use g2d
          // for thicker, better looking X's and O's
          if (useImages) g.drawImage(imageX, x1, y1, 75, 75, null);
          else {
            g2d.setColor(PURPLE);
            int x2 = (x + 1) * cellSize - 16;
            int y2 = (y + 1) * cellSize - 16;
            g2d.drawLine(x1, y1, x2, y2);
            g2d.drawLine(x2, y1, x1, y2);
          }
        } else if (board[y][x] == Symbol.O) {
          if (useImages) g.drawImage(imageO, x1, y1, 75, 75, null);
          else {
            g2d.setColor(Color.BLUE);
            g2d.drawOval(x1, y1, 70, 70);
          }
        }
      } // end for
    }

    // Set status bar based on gamestate.  If CONTINUE, show whose turn it is
    if (gameStatus == GameStatus.CONTINUE) {
      statusBar.setForeground(Color.BLACK);
      if (currentPlayer == Symbol.X) statusBar.setText("X's Turn");
      else statusBar.setText("O's Turn");
    } else if (gameStatus == GameStatus.DRAW) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("Draw! Click to play again!");
    } else if (gameStatus == GameStatus.X_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("X has won! Click to play again!");
    } else if (gameStatus == GameStatus.O_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("O has won! Click to play again!");
    }
  }
  public void Text(Graphics g) {
    g.setColor(Color.black);
    g.fillRoundRect(49, 69, 502, 512, 30, 30);
    g.setColor(Color.white);
    g.fillRoundRect(50, 70, 500, 510, 30, 30);
    g.setColor(Color.black);

    g.setFont(Ueberschrift);
    g.drawString("Nicht invertierender Verstärker", 180, 100);
  }
Example #6
0
 public void renderButton(Graphics g, int mouseX, int mouseY) {
   g.setColor(Color.BLACK);
   g.fillRoundRect(x_pos, y_pos, width, height, 20, 20);
   if (mouseOn(mouseX, mouseY)) g.setColor(Color.YELLOW);
   else g.setColor(new Color(0xD6, 0xAD, 0x33));
   g.fillRoundRect(x_pos + 2, y_pos + 2, width - 4, height - 4, 20, 20);
   g.setColor(Color.BLACK);
   g.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, height - 10));
   int x = x_pos + width / 2 - g.getFontMetrics().stringWidth(itemField) / 2;
   int y = y_pos + height - 7;
   g.drawString(itemField, x, y);
 }
  // drawings in the graphic
  public void paint(Graphics g) {
    super.paint(g); // calling super class's constructor
    int x, y; // x,y values to use in fillRoundRect
    int counter;

    // Calculating the color to fill for each row and filling it
    for (int n = this.baseLength; n > 0; n--) {
      // Update the x,y values of top left corner of each block. This is done once per row
      x = this.startX + (10 - n) * (this.legoWidth / 2);
      y = this.startY - (10 - n) * (this.legoHeight);

      counter = 0; // set the counter to 0 for each row
      // below loop runs for each block in a given row
      while (counter < n) {
        // If the block is at odd numbered position, set color to fill as red, blue otherwise. Uses
        // ternary operator
        Color toFill = (counter % 2 == 0) ? Color.RED : Color.BLUE;
        // Set the color to the color calculated above and fill the rectangle with this color
        g.setColor(toFill);
        g.fillRoundRect(x, y, this.legoWidth, this.legoHeight, 2, 2);
        x = x + this.legoWidth; // Update x position of top left coordinate of each block
        counter++; // Update the counter
      }
    }
  }
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    if (drawOverlay) {
      g = g.create();
      AntialiasingManager.activateAntialiasing(g);

      try {
        // Paint a roll over fade out.
        FadeTracker fadeTracker = FadeTracker.getInstance();

        float visibility = 0.0f;
        if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) {
          visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER);
          visibility /= 4;
        } else visibility = 0.5f;

        // Draw black overlay
        g.setColor(new Color(0.0f, 0.0f, 0.0f, visibility));
        g.fillRoundRect(1, 1, width - 2, height - 2, 10, 10);

        // Draw arrow
        g.setColor(Color.WHITE);

        int[] arrowX = new int[] {width - 17, width - 7, width - 12};
        int[] arrowY = new int[] {height - 12, height - 12, height - 7};
        g.fillPolygon(arrowX, arrowY, arrowX.length);
      } finally {
        g.dispose();
      }
    }
  }
 @Override
 protected void paintComponent(Graphics g) {
   // Draw Background.
   if (isEnabled()) {
     g.setColor(mouseStatus.getColor());
   } else {
     g.setColor(Color.WHITE.darker());
   }
   switch (btnStyle) {
     case Corner:
       g.drawRoundRect(
           0, 0, this.getWidth() - 1, this.getHeight() - 1, CORNER_ANGLE, CORNER_ANGLE);
       g.fillRoundRect(
           0, 0, this.getWidth() - 1, this.getHeight() - 1, CORNER_ANGLE, CORNER_ANGLE);
       break;
     case Rectangle:
       g.drawRect(0, 0, this.getWidth(), this.getHeight());
       g.fillRect(0, 0, this.getWidth(), this.getHeight());
       break;
     case Rectangle3D:
       g.fill3DRect(0, 0, this.getWidth(), this.getHeight(), true);
       break;
     default:
       break;
   }
 }
  private void createShadowBorder() {
    backgroundImage =
        new BufferedImage(
            getWidth() + SHADOW_WIDTH, getHeight() + SHADOW_WIDTH, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2 = (Graphics2D) backgroundImage.getGraphics();

    try {
      Robot robot = new Robot(getGraphicsConfiguration().getDevice());
      BufferedImage capture =
          robot.createScreenCapture(
              new Rectangle(getX(), getY(), getWidth() + SHADOW_WIDTH, getHeight() + SHADOW_WIDTH));
      g2.drawImage(capture, null, 0, 0);
    } catch (AWTException e) {
      e.printStackTrace();
    }

    BufferedImage shadow =
        new BufferedImage(
            getWidth() + SHADOW_WIDTH, getHeight() + SHADOW_WIDTH, BufferedImage.TYPE_INT_ARGB);
    Graphics graphics = shadow.getGraphics();
    graphics.setColor(new Color(0.0f, 0.0f, 0.0f, 0.3f));
    graphics.fillRoundRect(6, 6, getWidth(), getHeight(), 12, 12);

    g2.drawImage(shadow, getBlurOp(7), 0, 0);
  }
Example #11
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.setColor(kleur);
   g.fillRoundRect(5, 5, 70, 70, 10, 10);
   g.setColor(Color.black);
   if (waarde == 1) {
     g.fillOval(34, 34, 10, 10);
   } else if (waarde == 2) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 3) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(34, 34, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 4) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 5) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
     g.fillOval(34, 34, 10, 10);
   } else if (waarde == 6) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
     g.fillOval(10, 34, 10, 10);
     g.fillOval(60, 34, 10, 10);
   } else ; // meer waarden zijn er niet
 }
 // Draws this die when stopped
 private void drawStopped(Graphics g) {
   int x = xCenter - dieSize / 2;
   int y = yCenter - dieSize / 2;
   g.setColor(Color.RED);
   g.fillRoundRect(x, y, dieSize, dieSize, dieSize / 4, dieSize / 4);
   drawDots(g, x, y, getNumDots());
 }
 @Override
 public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
   g.setColor(new Color(0, 0, 255, 50));
   g.fillRoundRect(x, y, width, height, 10, 10);
   g.setColor(Color.white);
   g.drawRoundRect(x + 2, y + 2, width - 4, height - 4, 10, 10);
 }
Example #14
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   g.setColor(LightColors.SLIGHTLY_GREEN);
   g.fillRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8);
   g.setColor(Color.GRAY);
   g.drawRoundRect(x + 4, y + 4, 32 - 8, 32 - 8, 8, 8);
 }
Example #15
0
 void drawRoiLabel(Graphics g, int index, Roi roi) {
   Rectangle r = roi.getBounds();
   int x = screenX(r.x);
   int y = screenY(r.y);
   double mag = getMagnification();
   int width = (int) (r.width * mag);
   int height = (int) (r.height * mag);
   int size = width > 40 && height > 40 ? 12 : 9;
   if (font != null) {
     g.setFont(font);
     size = font.getSize();
   } else if (size == 12) g.setFont(largeFont);
   else g.setFont(smallFont);
   boolean drawingList = index >= LIST_OFFSET;
   if (drawingList) index -= LIST_OFFSET;
   String label = "" + (index + 1);
   if (drawNames && roi.getName() != null) label = roi.getName();
   FontMetrics metrics = g.getFontMetrics();
   int w = metrics.stringWidth(label);
   x = x + width / 2 - w / 2;
   y = y + height / 2 + Math.max(size / 2, 6);
   int h = metrics.getAscent() + metrics.getDescent();
   if (bgColor != null) {
     g.setColor(bgColor);
     g.fillRoundRect(x - 1, y - h + 2, w + 1, h - 3, 5, 5);
   }
   if (!drawingList && labelRects != null && index < labelRects.length)
     labelRects[index] = new Rectangle(x - 1, y - h + 2, w + 1, h);
   g.setColor(labelColor);
   g.drawString(label, x, y - 2);
   g.setColor(defaultColor);
 }
Example #16
0
 public void drawScorpion() {
   buf.setColor(Color.red.darker());
   buf.fillRoundRect(scorpX, scorpY, 10, 20, 7, 5);
   if (scorpX >= 300) {
     scorpX = 0;
     scorp = false;
   }
 }
Example #17
0
  @Override
  public void paint(BufferedImage buf) {
    Graphics g = buf.getGraphics();
    g.setColor(Color.green);

    for (Block b : blocks)
      g.fillRoundRect(b.getX(), b.getY(), b.getWidth(), b.getHeight() + 10, 5, 5);
  }
Example #18
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
  */
 @Override
 protected void paintComponent(final Graphics g) {
   this.w = this.getWidth();
   this.h = this.getHeight();
   g.setColor(this.getBackground());
   g.fillRoundRect(this.i, this.i, this.w - (2 * this.i), this.h - this.i, this.r, this.r);
   super.paintComponent(g);
 }
Example #19
0
 @Override
 protected void paintComponent(Graphics g) {
   // TODO Move this code to a UI if necessary, for now KIFSS
   g.setColor(getBackground());
   g.fillRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 2, 2);
   g.setColor(new Color(0xe4e8ea));
   g.drawRoundRect(0, 0, getWidth() - 1, getHeight() - 1, 2, 2);
   super.paintComponent(g);
 }
 @Override
 public void paintComponent(Graphics g) {
   if (selected) {
     g.setColor(selColor);
     g.fillRoundRect(0, 0, getWidth(), getHeight(), getWidth() / 10, getHeight() / 10);
     label.setForeground(Color.YELLOW);
   } else label.setForeground(Color.WHITE);
   super.paintComponent(g);
 }
Example #21
0
  public void paint(Graphics g) {

    if (NumPlayer >= 2) {
      g.drawImage(P1, P1X, P1Y, P1WIDTH, P1HEIGHT, this);
      g.drawImage(P2, P2X, P2Y, P2WIDTH, P2HEIGHT, this);
    }
    if (NumPlayer >= 3) g.drawImage(P3, P3X, P3Y, P3WIDTH, P3HEIGHT, this);
    if (NumPlayer >= 4) g.drawImage(P4, P4X, P4Y, P4WIDTH, P4HEIGHT, this);

    g.setFont(new Font("BOLD", 1, 36));
    g.drawString("" + GameTime, 470, 40);

    if (NumPlayer >= 2) {
      g.setColor(intToColor(P1color));
      g.fillRoundRect(10, 20, 400 * BloodP1 / 100, 18, 22, 22);
      g.drawString("" + P1Points, 10, 80);
      g.drawString("" + P1name, 90, 80);
      g.setColor(intToColor(3));
      g.setFont(new Font("BOLD", 1, 12));
      g.drawString("Server's IP Address: " + ip, 10, 120);
      g.setFont(new Font("BOLD", 1, 36));
      g.setColor(intToColor(P2color));
      g.fillRoundRect(612, 20, 400 * BloodP2 / 100, 18, 22, 22);
      g.drawString("" + P2Points, 612, 80);
      g.drawString("" + P2name, 692, 80);
    }
    if (NumPlayer >= 3) {
      g.setColor(intToColor(P3color));
      g.fillRoundRect(10, 640, 400 * BloodP3 / 100, 18, 22, 22);
      g.drawString("" + P3Points, 10, 630);
      g.drawString("" + P3name, 90, 630);
    }
    if (NumPlayer >= 4) {
      g.setColor(intToColor(P4color));
      g.fillRoundRect(612, 640, 400 * BloodP4 / 100, 18, 22, 22);
      g.drawString("" + P4Points, 612, 630);
      g.drawString("" + P4name, 692, 630);
    }
    g.setColor(new Color(32, 32, 150));
    if (WhetherFlower) {
      g.fillRoundRect(700, 400, 500, 200, 45, 45);
      g.fillRoundRect(-10, 400, 500, 200, 45, 45);
    }
  }
Example #22
0
  /**
   * Renders card type selection if needed
   *
   * @param g - refernce to graphic content
   * @param g_src - reference to class which holds informations about rendering
   * @param mouseX - X position of mouse
   * @param mouseY - Y position of mouse
   * @param width - width of display
   * @param height - height of display
   */
  public static void renderSelectType(Graphics g, CGraphics g_src, int mouseX, int mouseY) {
    g.setColor(new Color(88, 88, 88, 180));
    g.fillRect(0, 0, g_src.displayWidth(), g_src.displayHeight());
    Image temp = null;

    String label = "Vyber farbu";
    g.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 40));
    FontMetrics metrics = g.getFontMetrics();
    g.setColor(Color.RED);
    g.drawString(
        label,
        g_src.displayWidth() / 2 - metrics.stringWidth(label) / 2,
        g_src.displayHeight() / 4 + metrics.getHeight());

    for (int i = 0; i < 4; i++) {

      RoundRectangle2D.Double outline = getTypeOutline(g_src, i);
      boolean mouseon = outline.contains(mouseX, mouseY);
      temp = g_src.getType(i);
      int x = (int) outline.getX();
      int y = (int) outline.getY();
      int width = (int) outline.getWidth();
      g.setColor(new Color(0x6C, 0x43, 0x19));
      g.fillRoundRect(x - 5, y - 5, width + 10, width + 10, 10, 10);
      g.setColor(new Color(0xFF, 0xFF, 0xB8));
      g.fillRoundRect(x, y, width, width, 10, 10);
      g.drawImage(
          temp,
          x + 5,
          y + 5,
          x + width - 5,
          y + width - 5,
          0,
          0,
          temp.getWidth(null),
          temp.getHeight(null),
          null);
      if (!mouseon) {
        g.setColor(new Color(88, 88, 88, 120));
        g.fillRoundRect(x, y, width, width, 10, 10);
      }
    }
  }
Example #23
0
    @Override
    public void paintComponent(Graphics g) {
      int w = this.getWidth();

      if ((!Page.this.hideMinimize)) {
        if (fullview) {
          this.setToolTipText("Collapse " + this.button_text);
          paintFull(g);
          if (pressed) {
            g.setColor(Color.blue.darker());
            g.fillRoundRect(3, 3, w - 6, w - 6, 3, 3);
            paintFull(g);
          } else {
            if (focus) {
              g.setColor(new Color(51, 153, 255)); // light blue
              g.fillRoundRect(3, 3, w - 6, w - 6, 3, 3);
              paintFull(g);
            }
          }
        } else {
          this.setToolTipText("Restore " + this.button_text);
          paintCollapsed(g);
          if (pressed) {
            g.setColor(Color.blue.darker());
            g.fillRoundRect(3, 3, w - 6, w - 6 + charSet.length * (FONT_SIZE + 3), 3, 3);
            paintCollapsed(g);
          } else {
            if (focus) {
              g.setColor(new Color(51, 153, 255)); // light blue
              g.fillRoundRect(3, 3, w - 6, w - 6 + charSet.length * (FONT_SIZE + 3), 3, 3);
              paintCollapsed(g);
            }
          }
        }
      } else {
        if (fullview) {
          paintFull(g, Color.gray);
        } else {
          paintCollapsed(g, Color.gray);
        }
      }
    }
Example #24
0
 public void stare_paint(Graphics g) {
   int licznik = 0;
   test++;
   for (int i = 0; i < 100; i += 3) {
     g.setColor(kolory[licznik++ % kolory.length]);
     g.fillRoundRect(i, i, 400 - i * 2, 200 - i * 2, 10, 10);
   }
   g.setFont(f);
   g.setColor(kolor);
   g.drawString("Trebuchet MS jest " + test, 50, 100);
 }
Example #25
0
 @Override
 public void paintIcon(Component c, Graphics g, int x, int y) {
   if (g instanceof Graphics2D) {
     ((Graphics2D) g)
         .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
   }
   g.setColor(tagSet.equals(highlighted) ? color.brighter() : color);
   g.fillRoundRect(x, y, ICON_WIDTH - 1, ICON_HEIGHT - 1, ICON_WIDTH / 2, ICON_WIDTH / 2);
   g.setColor(color.darker());
   g.drawRoundRect(x, y, ICON_WIDTH - 1, ICON_HEIGHT - 1, ICON_WIDTH / 2, ICON_WIDTH / 2);
 }
  // Draws this die when rolling with a random number of dots
  private void drawRolling(Graphics g) {
    int x = xCenter - dieSize / 2 + (int) (3 * Math.random()) - 1;
    int y = yCenter - dieSize / 2 + (int) (3 * Math.random()) - 1;
    g.setColor(Color.RED);

    if (x % 2 != 0) g.fillRoundRect(x, y, dieSize, dieSize, dieSize / 4, dieSize / 4);
    else g.fillOval(x - 2, y - 2, dieSize + 4, dieSize + 4);

    Die die = new Die();
    die.roll();
    drawDots(g, x, y, die.getNumDots());
  }
Example #27
0
  public void paint(Graphics g, int x, int y, int tileSize) {
    int size = (int) (tileSize * .9);

    int drawX = x + (tileSize / 2) - (size / 2);
    int drawY = y + (tileSize / 2) - (size / 2);

    g.setColor(Color.YELLOW);
    g.fillRoundRect(drawX, drawY, size, size, 16, 16);

    g.setColor(Color.BLACK);
    g.drawRoundRect(drawX, drawY, size, size, 16, 16);
  }
Example #28
0
  /**
   * Customizes the background of this panel, by painting a round rectangle in the background color
   * previously set.
   *
   * @param g the <tt>Graphics</tt> object to use for painting
   */
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    g = g.create();

    try {
      AntialiasingManager.activateAntialiasing(g);

      g.setColor(backgroundColor);
      g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 20, 20);
    } finally {
      g.dispose();
    }
  }
Example #29
0
 @Override
 public void onRepaint(final Graphics g) {
   if (showing || !showing) {
     g.setColor(color5);
     g.fillRoundRect(540, 400, 200, 60, 16, 16);
     g.setColor(color2);
     g.drawRoundRect(540, 400, 200, 60, 16, 16);
     g.setFont(font3);
     g.setColor(color6);
     g.drawString("Show | Hide Paint", 545, 440);
   }
   newPaint(g);
 }
    /** @see CH.ifa.draw.standard.AbstractFigure#draw(Graphics g) */
    public void draw(Graphics g) {
      for (int i = 0; i < regions.length; i++) {
        if (i == oldIndex || i == oldIndex + 1) {
          continue;
        }

        g.setColor(ModelerColors.CONNECTION_ACCEPT);
        g.fillRoundRect(regions[i].x, regions[i].y, regions[i].width, regions[i].height, 8, 8);

        g.setColor(Color.BLACK);
        g.drawRoundRect(regions[i].x, regions[i].y, regions[i].width, regions[i].height, 8, 8);
      }
    }