ni562 Posted December 30, 2015 Share Posted December 30, 2015 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. Quote Link to comment Share on other sites More sharing options...
Precise Posted December 30, 2015 Share Posted December 30, 2015 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 ^_^ Quote Link to comment Share on other sites More sharing options...
Explv Posted December 30, 2015 Share Posted December 30, 2015 (edited) 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 December 30, 2015 by Explv Quote Link to comment Share on other sites More sharing options...
Fluttershy Posted December 30, 2015 Share Posted December 30, 2015 (edited) public void onPaint(Graphics2D g) { Graphics2D gr = g; g.drawString("hahahahhahahh", 16, 105); } i didnt read all the OP this works for me i just started doing it today also so no hate pls Edited December 30, 2015 by Fluttershy Quote Link to comment Share on other sites More sharing options...
ni562 Posted December 30, 2015 Author Share Posted December 30, 2015 (edited) 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 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 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 December 30, 2015 by ni562 Quote Link to comment Share on other sites More sharing options...
Fluttershy Posted December 30, 2015 Share Posted December 30, 2015 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 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 Quote Link to comment Share on other sites More sharing options...