Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1.     //author flaetch_to_99
  2.     private void drawProgressBar(final Graphics2D g, final int skill,
  3.             final int x, final int y, final int width, final int height,
  4.             final Color colorBase, final Color colorOver,
  5.             final Color textColor, final int alpha) {
  6.         final GradientPaint base = new GradientPaint(x, y, new Color(200, 200,
  7.                 200, alpha), x, y + height + 3, colorBase);
  8.         final GradientPaint overlay = new GradientPaint(x, y, new Color(200,
  9.                 200, 200, alpha), x, y + height + 3, colorOver);
  10.         g.setStroke(new BasicStroke(1));
  11.         g.setPaint(base);
  12.         g.fillRect(x, y, width, height);
  13.         g.setPaint(overlay);
  14.         g.fillRect(x, y,
  15.                 (int) (width * Skills.getPercentToNextLevel(skill) / 100.0),
  16.                 height);
  17.         g.setColor(Color.BLACK);
  18.         g.drawRect(x, y, width, height);
  19.         g.setFont(new Font("Arial", 1, (width / 35 + height / 5)));
  20.         final String progress = Skills.getPercentToNextLevel(skill) + "% to "
  21.                 + (Skills.getCurrentLevel(skill) + 1) + " "
  22.                 + Skills.SKILL_NAMES[skill] + " | "
  23.                 + Skills.getExpToNextLevel(skill) + " XP Until level";
  24.         g.setColor(new Color(textColor.getRed(), textColor.getGreen(),
  25.                 textColor.getBlue(), 150));
  26.         g
  27.                 .drawString(
  28.                         progress,
  29.                         x + (width - g.getFontMetrics().stringWidth(progress))
  30.                                 / 2,
  31.                         (int) (y + (g.getFontMetrics().getHeight() / 2 + height / 4 * 1.65)));
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement