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
  • onPaint() doesn't appear to be rendering


    ggdre

    Recommended Posts

    EDIT: Solved by enabling script paint in menu... someone please delete this to hide my shame

     

    I'll start off by saying I'm completely new to programming with DreamBot and Java as a whole.

    Tried writing my first DB script today (a simple banking woodcutter) but can't for the life of me get onPaint() to paint my strings. I've ready many of the (really great) guides on this forum and still can't get it to work. I know I must be missing something simple - here is my code:

    	private Timer timer;
    
    	@Override
        public void onPaint(Graphics graphics) {
            Graphics2D g = (Graphics2D)graphics; // Have tried both with and without casting to Graphics2D
            g.setColor(Color.GREEN);
            g.setFont(new Font("Arial",Font.PLAIN,12));
            g.drawString("XP/hour: " + SkillTracker.getGainedExperiencePerHour(Skill.WOODCUTTING),15,15);
            g.drawString("Total XP: " + SkillTracker.getGainedExperience(Skill.WOODCUTTING),15,35);
            g.drawString("Running for: " + timer,15,55);
            super.onPaint(g); // Have also tried with and without with no luck
        }

    I'm not calling onPaint() on paint anywhere else, which is my first thought as someone familiar with Python.

    Please help if you know how!

    Edited by ggdre
    I'm an idiot
    Link to comment
    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.