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
  • Try asking for help in the chatbox
  • drawStringShadow - Draw text on screen with a shadow!


    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 post
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • 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.