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
  • Creating GUI Help


    Sheperdebops

    Recommended Posts

    Hello everyone im having problems with creating a GUI when i call createGUI in onStart() nothings happens heres my code

    package org.dreambot.sheperdebops;
    
    import  org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.wrappers.interactive.GameObject;
    
    import javax.swing.*;
    import java.awt.*;
    
    @ScriptManifest(category = Category.MINING, description = "Auto Mines then Smiths and banks Iron", name = "AIO Process", author = "Sheperdebops", version = 0.1)
    public class Main extends AbstractScript{
    
        private boolean isRunning;
        private String Ore;
        private boolean Bank;
        private boolean Smith;
        private boolean useGE;
    
        @Override
        public void onStart() {
            createGUI();
        }
    
        private void createGUI()
        {
            JFrame frame = new JFrame();
            frame.setTitle("Auto Miner");
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setLocationRelativeTo(getClient().getInstance().getCanvas());
            frame.setPreferredSize(new Dimension( 400, 500));
    
            JPanel settingPanel = new JPanel();
            settingPanel.setLayout(new GridLayout( 0 ,2));
    
            JLabel MaterialLabel = new JLabel();
            MaterialLabel.setText("Select Ingot");
            settingPanel.add(MaterialLabel);
        }
    
        @Override
        public void onPaint(Graphics Label) {
    
            Label.setColor(Color.BLACK);
            Label.fillRect( 10,  50, 220, 25);
    
            Label.setColor((Color.WHITE));
            Label.drawString( "AIO Process by Sheperdebops - v0.2", 15, 65 );
    
        }
    
        @Override
        public int onLoop() {
            return 1000;
        }
    
    }

     

    Link to comment
    Share on other sites

    5 minutes ago, Man16 said:

    Have you tried setting its visibility?

    of course java visibility is automatically set to false. im used to C++ and C# thanks a bunch!!

    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.