Skip 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.

onPaint()

Featured Replies

public void onPaint(Graphics g) {

Graphics2D gr = (Graphics2D) g;
gr.drawString("hahhahahaahha", 16, 105);

}

any idea why this isn't drawing anything on screen? Iv been messing around with it and it just wont draw anything to screen . I tried just using g (not gr) and still no luck.

public void onPaint(Graphics g) {

Graphics2D gr = (Graphics2D) g;
gr.drawString("hahhahahaahha", 16, 105);

}

any idea why this isn't drawing anything on screen? Iv been messing around with it and it just wont draw anything to screen . I tried just using g (not gr) and still no luck.

 

public void onPaint(Graphics2D gr) {

gr.drawString("hahhahahaahha", 16, 105);

}

was the wrong parameter ^_^

public void onPaint(Graphics g) {

Graphics2D gr = (Graphics2D) g;
gr.drawString("hahhahahaahha", 16, 105);

}

any idea why this isn't drawing anything on screen? Iv been messing around with it and it just wont draw anything to screen . I tried just using g (not gr) and still no luck.

 

 

 

You override the methods in Script when you want to use them, this means both the return type and parameters must be identical:

@ScriptManifest(author = "", name = "", info = "", version = 0, logo = "")
public class Main extends Script{

    @Override
    public void onStart(){

    }

    @Override
    public int onLoop() throws InterruptedException{

        return 0;
    }

    @Override
    public void onPaint(Graphics2D g){

    }

    @Override
    public void onExit(){

    }
}

Edited by Explv

  public void onPaint(Graphics2D g)
      {
        Graphics2D gr = g;
        g.drawString("hahahahhahahh", 16, 105);
      }

i didnt read all the OP :???:

 

this works for me :doge: i just started doing it today also so no hate pls :kappa:

Edited by Fluttershy

  • Author

i only started learning how to do it earlier today but shouldnt this;

gr.drawString("hahhahahaahha", 16, 105);

be just

g.drawString("hahhahahaahha", 16, 105);

like i said, i just started today so i dont know if that 'r' makes any of a difference. i just know that i dont have it in mine and it works emote32342.png

 

 

well i have

public void onPaint(Graphics2D g)

{

Graphics2D gr = g;

g.drawString("hahahahhahahh", 16, 105);

}

 

 

 

yeah, i should have left it as g. I casted it to Graphics2D because initially my parameter was only Graphics and i knew it should be Graphics2D...Why did i not think of changing the parameter?...i dont know sad.png

 

You can look up type casting in java if u didn't understand this bit of code

Graphics2D gr = (Graphics2D) g;

It looks to me like gr in your code is an unused variable. meaning it has been assigned a value but it is never being called. Your code should work without that line.

Edited by ni562

yeah, i should have left it as g. I casted it to Graphics2D because initially my parameter was only Graphics and i knew it should be Graphics2D...Why did i not think of changing the parameter?...i dont know sad.png

 

You can look up type casting in java if u didn't understand this bit of code

Graphics2D gr = (Graphics2D) g;

It looks to me like gr in your code is an unused variable. meaning it has been assigned a value but it is never being called.

i should of refreshed before editing my post NotLikeThis haha 

 

i think i just pretty much copied and pasted from pugs tutorial :doge:

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.