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.

Use onPaint from another class

Featured Replies

I have variables in my secondary class I want to implement in the onPaint of my main class.  How would I pull in those vars?


StaticSecondaryClass.variable; //If .variable has the "public static" modifier

StaticSecondaryClass ssc = new StaticSecondaryClass();

ssc.variable; //If .variable has just a "public" modifier

I have variables in my secondary class I want to implement in the onPaint of my main class.  How would I pull in those vars?

 

Method 1

 

in your SecondaryClass:

toPaint(Graphics2D g2d){
g2d.drawString("This is text added to the g2d by the secondary class", 1, 1);
}

in your Primary Class:

private SecondaryClass instance;

@override
onPaint(Graphics2D g2d) {
instance.toPaint(g2d);
}

Method 2

 

You could also just use accessors:

 

in your SecondaryClass:

private x var1 = something;
private x var2= something;

public x getVar1() {return var1;}
public x getVar2() {return var2;}

in your Primary Class:

private SecondaryClass instance;

@override
onPaint(Graphics2D g2d) {
g2d.draw(instance.getVar1(), 0, 0);
g2d.draw(instance.getVar2(), 0, 0);
}

Written without an IDE but should get the point across, there are other ways to do it but these are a good start imho.

  • Author

Method 1

 

in your SecondaryClass:

toPaint(Graphics2D g2d){
g2d.drawString("This is text added to the g2d by the secondary class", 1, 1);
}

in your Primary Class:

private SecondaryClass instance;

@override
onPaint(Graphics2D g2d) {
instance.toPaint(g2d);
}

Method 2

 

You could also just use accessors:

 

in your SecondaryClass:

private x var1 = something;
private x var2= something;

public x getVar1() {return var1;}
public x getVar2() {return var2;}

in your Primary Class:

private SecondaryClass instance;

@override
onPaint(Graphics2D g2d) {
g2d.draw(instance.getVar1(), 0, 0);
g2d.draw(instance.getVar2(), 0, 0);
}

Written without an IDE but should get the point across, there are other ways to do it but these are a good start imho.

Method 1 didn't work

There is a better way to do this, but I don't know if it is what you want.

 

You can have you entire paint in another class, then just add it as the paint listener on script start, or where ever you need it.

 

I think its like, script.addPaintListener(new YOURPAINTCLASS)

 

Then just implement the paint listener in that class and tada you're done

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.