As was said above, change what you have to this:
public void onPaint(Graphics2D g) {
long millis = System.currentTimeMillis()
- /* this.variables. */startTime;
long hours = millis / 3600000L;
millis -= hours * 3600000L;
long minutes = millis / 60000L;
millis -= minutes * 60000L;
long seconds = millis / 1000L;
// DateFormat df = new SimpleDateFormat("mm:ss");
g.setColor(Color.WHITE);
g.setFont(new Font("Arial", Font.BOLD, 15));
g.drawString("Main script state: " + (mainState), 150, 20);
g.setColor(Color.ORANGE);
g.setFont(new Font("Arial", Font.PLAIN, 12));
g.drawString("Sub script state: " + (subState), 25, 35);
g.drawString("Time running: "
+ (hours + ":" + minutes + ":" + seconds), 25, 50);
}