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
  • SettingsDrawer - Display debug info without a hassle


    Downsidelama

    Recommended Posts

    import java.awt.*;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.concurrent.atomic.AtomicInteger;
    
    /**
     * Draws settings to the screen.
     */
    
    public class SettingsDrawer {
        private final Color color = new Color(255, 255, 255);
    
        private final Font font = new Font("Arial", 0, 20);
    
        private Map<String, String> settings;
        private static SettingsDrawer instance;
    
        public static SettingsDrawer getInstance() {
            if(instance == null) {
                instance = new SettingsDrawer();
            }
            return instance;
        }
    
        private SettingsDrawer() {
            settings = new HashMap<>();
        }
    
        public void addSetting(String setting, String value) {
            this.settings.put(setting, value);
        }
    
        public void draw(Graphics g) {
            AtomicInteger y = new AtomicInteger(40);
            int x = 20;
            int increment = 30;
    
            g.setFont(font);
            g.setColor(color);
    
            settings.forEach((k, v) -> {
                g.drawString(String.format("%s: %s", k, v), x, y.get());
                y.addAndGet(increment);
            });
        }
    }

     

    Call the draw(g) function in the onPaint function.

    Call the addSetting(...) method to insert things to display.

    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.