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
  • drawStringShadow - Draw text on screen with a shadow!


    holic

    Recommended Posts

    I'm in the sharing mood so here's a real simple but very useful one.

    void drawStringShadow(Graphics g, String text, int x, int y)

    It's often hard to read text on the canvas but adding a shadow to your text goes a long ways. It's simple but I don't see it many scripts and I assume it's because once people see there's not a native method or property for it they bail on it so here, have at it!

    private void drawStringShadow(Graphics g, String text, int x, int y) {
        Color c = g.getColor();
        g.setColor(Color.BLACK);
        g.drawString(text, x + 1, y + 1);
        g.setColor(c);
        g.drawString(text, x, y);
    }

    Use it just as you would Graphics#drawString but include your graphics variable in the arguments and set the graphic's colour before calling drawStringShadow, just as you would normally:

    g.setColor(new Color(168, 219, 168));
    drawStringShadow(g, scriptStatus, drawX, drawY);

     

    Hope this helps some newbies!

    Link to comment
    Share on other sites

    Archived

    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.