Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

implementing GUI in main class

Featured Replies

Ok so i've made this unfinished gui using window builder and now I want it to just pop up when i start my script, nothing more.

I've tried to make an object of it in my main script class and also experimented and tried a bunch of diffrent things but nothing works (the script wont even start up).

 

my gui class:

http://pastebin.com/38v3WGrE

Edited by dokato

remove 

 
        public static void main(String[] args) {
                        GUI window = new GUI();
                        window.frame.setVisible(true);
        }

in the main class create a simple instance of the gui

GUI window = new GUI();

then in the onstart you make it visible

window.frame.setVisible(true);

and incase you are waiting for gui to end before you continue with the script. 

 

in the onloop add a simple isVisible()  boolean check

Edited by josedpay

still doesnt work

change 

window.frame.setVisible(true);

to 

window.setVisible(true);
  • Author

 

change 

window.frame.setVisible(true);

to 

window.setVisible(true);

 

nope still doesnt work,

i also tried some additional thing as well but nothing works

  • Author

any error code?

 

no error at all

the script doesnt start when i click start, even the paint doesnt show up

unless i undo what ive added :(

Edited by dokato

no error at all

the script doesnt start when i click start, even the paint doesnt show up

unless i undo what ive added sad.png

ok so keep this in the onStart

 GUI window = new GUI();

Your gui class extend JFrame so use it. What you did was created a new jFrame instance instead of using the classes JFrame. So delete

frame = new JFrame();
private JFrame frame;

you will get a few error with "frame." simply remove it and it should be good.

 

finally at the end of gui constructor the last line should be 

Gui() {
//stuff
setVisible(true);
}

no need for setVisible in the onstart since its in the constructor 

Edited by josedpay

  • Author

ok so keep this in the onStart

 GUI window = new GUI();

Your gui class extend JFrame so use it. What you did was created a new jFrame instance instead of using the classes JFrame. So delete

frame = new JFrame();
private JFrame frame;

you will get a few error with "frame." simply remove it and it should be good.

 

finally at the end of gui constructor the last line should be 

Gui() {
//stuff
setVisible(true);
}

no need for setVisible in the onstart since its in the constructor 

 

still doesnt work :(

and the script doesnt startup

Should run the gui on its own thread.

SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
               Gui gui = new Gui();
               gui.setVisible(true);
            }
        });

Also you should make your own GUI, cleaner then the spam out of windowbuilder.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.