Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Paint issues


    Recommended Posts

    I have the following code


        String dateToFormat(long time) {
            double hour = Math.floor(time);
            double minute = (time - hour) * 60;
            return String.format("%02d:%02d", hour, minute);
        public void onPaint(Graphics graphics) {
            int numPerHr = (int)(numMade / ((System.currentTimeMillis() - timeBegan) / 3600000.0D));
            graphics.fillRect(518, 0, 246, 165);
            graphics.drawString("Running for: " + timer.formatTime(), 549, 25);
            graphics.drawString("Num made: " + numMade, 549, 50);
            graphics.drawString("Num per hour: " + numPerHr, 549, 75);
            graphics.drawString("Time remaining: " + dateToFormat(timer.remaining()), 549, 100);

    But when I run the script the paint looks like it's not rendering the final line


    Screengrab: https://imgur.com/9K9muTy


    So my questions are how do I get the last line to render, and why is my text so blurry?

    Link to comment
    Share on other sites

    Generally I've found in my personal scripts that the issue with strings not drawing is a logical error on my part, that's not to say it necessarily is in yours, but it may be worth double checking the method in question is operating as expected. (Try printing the result to the log).


    As for blurry text, I've found toggling Anti aliasing to be a big help, see below.


    Within onPaint:



    Graphics2D g = (Graphics2D) graphics;


    Link to comment
    Share on other sites

    Wrap your paint with a try/catch and log the errors to find out what the problem is.

            try {
            } catch (Exception e) {
                for (StackTraceElement ex : e.getStackTrace())
                    log("Error onPaint: " + ex.toString());

    Something like that should show you what's going on.

    Link to comment
    Share on other sites


    This topic is now archived and is closed to further replies.

    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.