/** * Draws a progress bar using the co-ordinates, dimensions and skill provided. This also displays * current level in the skill, percent till the next level & exp needed to reach the next level * * @param g An instance of Graphics to paintType to. * @param skill The number of the skill wanting to display. E.g Skills.MAGIC * @param x The "x" co-ordinate. * @param y The "y" co-ordinate. * @param w The width of the progress bar. * @param h The height of the progress bar. * @param hover If you want extra info to be displayed (Usually for when the skill is "Hovered") * @author Rudday, UberMouse */ public void drawProgressBar(Graphics g, int skill, int x, int y, int w, int h, boolean hover) { Graphics2D g2 = (Graphics2D) g; Paint p = g2.getPaint(); GradientPaint grad1 = new GradientPaint(x, y, scheme.firstGradient1, x, y + h + 3, scheme.firstGradient2); GradientPaint grad2 = new GradientPaint(x, y, scheme.secondGradient1, x, y + h + 3, scheme.secondGradient2); g2.setPaint(grad1); g2.fillRect(x, y, w, h); g2.setPaint(grad2); g2.fillRect(x, y, (int) (w * (UberSkills.getPercentToNextLevel(skill) / 100.0)), h); g2.setColor(scheme.text); g2.drawRect(x, y, w, h); g2.setFont(new Font("Arial", 0, 9)); String progress = UberSkills.getPercentToNextLevel(skill) + "% to " + ((UberSkills.getRealLevel(skill) + 1 <= 120) ? UberSkills.getRealLevel(skill) + 1 : 120) + " " + name + " | " + UberSkills.getExpToNextLevel(skill) + " XPTL"; g2.drawString( progress, x + ((w - (g.getFontMetrics().stringWidth(progress))) / 2), (int) (y + ((g.getFontMetrics().getHeight() / 2) + (h / 4) * 1.75))); g2.setPaint(p); if (hover) { g2.setColor(scheme.hover); g2.fillRect(x, y - (height + 2), width, height); g2.setColor(scheme.text); g2.drawRect(x, y - (height + 2), width, height); progress = "TTL: " + skillInfo.timeToLevel() + " XPG: " + skillInfo.xpGained() + " XPPH: " + skillInfo.xpPH() + " LG: " + skillInfo.levelsGained(); g2.drawString( progress, x + ((w - (g.getFontMetrics().stringWidth(progress))) / 2), (int) ((y - (height + 2)) + ((g.getFontMetrics().getHeight() / 2) + (h / 4) * 1.75))); } }