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.

Get an instance of a Scene (javafx)

Featured Replies

Im trying to find a way so that in main i can declare a class that extends stage and call upon it like a jframe object.

 //I want something like this...
Class Gui extends Stage { ...}
 
 
Class Main{
 
public static void main(String[] args){
 Gui myGui =new Gui();
 
 Gui.start();
 
 String textboxField = Gui.getSomeRandomField();
 
 
}
}
 

At the moment im stuck with having all my code jammed into main and it is an eye soar every time I peek at the code

 

 

Goal is to create a controller to be able to interact with the gui class and my model class.

https://github.com/jaavant/ExcelFormatter

Edited by Qubit

Alright, so based on the stuff you've shown here, the best way of doing this that I can think of for you is using getters / setters in the Main class. The reason for this, is because I believe you shouldn't access the GUI everytime you need data, as its an independent object. However, if this approach doesnt suit you, you can always do a singleton.

 

Getter / Setter design:

public class GUI extends Stage {
    private Main instance;

    public GUI(Main instance){
        this.instance = instance;
    }


    // Can be any event, such as the start button being pressed.
    public void start(){
       instance.setTxtBox1(txtBox1.toString()) // whatever is in textbox 1, i forgot the statement to return that
    }

}

public class Main {
    
    private String txtBox1;

    public static void main(String[] args){
        new GUI(this);
    }


    public String getTxtBox1(){
        return txtBox1;
    }

    public void setTxtBox1(String str){
        txtBox1 = str;
    }
}

Edited by Tom

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.