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.

GUI help

Featured Replies

I have built a gui class using windowsbuilder in eclipse, my problem is that I can figure out how to call the class in the onStart method and also wait on the activation of the onLoop method untill a press of a button in the gui.

p.s. my java knowlage is extremely basic as you can understand.

  • Author
GUI g = new GUI();

onStart() {
g.setVisible(true);
while (g.isVisible()) { sleep(400); }
}

 

how do I make sure that the user have selected an item? cuz if i just do sleep it may not work some times...

how do I make sure that the user have selected an item? cuz if i just do sleep it may not work some times...

 

Within GUI (textbox as an example)

if (textBox.getText().isEmpty()) {
    JOptionPane.showMessageDialog(null, "You must fill out this text box first!");
    return;
}

The return; will stop execution of the method. I personally have a boolean in my main class, guiWait, which I then set from true to false when the GUI has applied the settings. I do something like this:

GUI g = new GUI();
public static boolean guiWait = true;
onStart() {
g.setVisible(true);
while (guiWait) { sleep(400); }
}

//GUI

//Button actionPerformed
if (conditionsMet) {
    ArbitraryScriptClass.guiWait = false;
}
else {
    JOptionPane.showMessageDialog(null, "You must select a preset or define a monster first!");
}

to have the GUI settings saved to your main class, you should put an action listener on your start button. Google how to do this , or in window builder right click the component and go action>actionPerformed

then just statically send your GUI variables to your desired location before putting a setVisible(false) in the action listener for the start button.

Not a neat way of doing it but does the job just fine and is pretty basic

apa

to have the GUI settings saved to your main class, you should put an action listener on your start button. Google how to do this , or in window builder right click the component and go action>actionPerformed

then just statically send your GUI variables to your desired location before putting a setVisible(false) in the action listener for the start button.

Not a neat way of doing it but does the job just fine and is pretty basic

apa

Why would you make the gui invisible rather than closing it? Doesn't make sense.

Why would you make the gui invisible rather than closing it? Doesn't make sense.

 

what if you press start, how would you "close it"?

what if you press start, how would you "close it"?

 

I always personally leave my GUIs open so people can screenshot them for bug reports, but I believe you can set it to close the GUI without ending the script.

I always personally leave my GUIs open so people can screenshot them for bug reports, but I believe you can set it to close the GUI without ending the script.

 

you can.

Why would you make the gui invisible rather than closing it? Doesn't make sense.

You can do either, but personally I make them invisible so should it be required, you can just show it again without recreating it

but to be honest it doesn't really matter

what if you press start, how would you "close it"?

Dispose()

Edited by Psvxe

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.