Hey guys I have found that this bit of code causes a heap of lag anyone able to help with the lag issue ?
public void onPaint(Graphics2D gr) {
try {
image = ImageIO.read(new URL(
"http://i1285.photobucket.com/albums/a589/whipz/EA1C0CF0C2DDBCB04C0258B8960138B33A6C1292DB3DF36762pimgpsh_fullsize_distr_zpsdo2x7ou1.jpg"));
} catch (IOException e) {
e.printStackTrace();
}
gr.drawImage(image, 4, 342, null);
final long runTime = System.currentTimeMillis() - startTime;
int x = getMouse().getPosition().x;
int y = getMouse().getPosition().y;
gr.drawLine(0, y, 765, y);
gr.drawLine(x, 0, x, 503);
gr.drawString(formatTime(runTime), 125, 375);
gr.drawString("", 125, 390);
gr.drawString("" + getSkills().getStatic(Skill.COOKING), 125, 405);
gr.drawString("" + getExperienceTracker().getGainedLevels(Skill.COOKING), 125, 420);
gr.drawString("" + formatValue(getExperienceTracker().getGainedXP(Skill.COOKING)), 125, 435);
gr.drawString("" + formatValue(getExperienceTracker().getGainedXPPerHour(Skill.COOKING)), 125, 450);
gr.drawString("" + formatValue(getSkills().experienceToLevel(Skill.ATTACK)), 125, 465);
}
Yet this doesnt so its obviously the image but how can i reduce the lag as it causes the script to almost not move
this is code with no lag
public void onPaint(Graphics2D gr) {
final long runTime = System.currentTimeMillis() - startTime;
int x = getMouse().getPosition().x;
int y = getMouse().getPosition().y;
gr.drawLine(0, y, 765, y);
gr.drawLine(x, 0, x, 503);
gr.drawString(formatTime(runTime), 125, 375);
gr.drawString("", 125, 390);
gr.drawString("" + getSkills().getStatic(Skill.COOKING), 125, 405);
gr.drawString("" + getExperienceTracker().getGainedLevels(Skill.COOKING), 125, 420);
gr.drawString("" + formatValue(getExperienceTracker().getGainedXP(Skill.COOKING)), 125, 435);
gr.drawString("" + formatValue(getExperienceTracker().getGainedXPPerHour(Skill.COOKING)), 125, 450);
gr.drawString("" + formatValue(getSkills().experienceToLevel(Skill.ATTACK)), 125, 465);
}
Thanks for any help or suggestions