dokato Posted April 2, 2015 Share Posted April 2, 2015 Ok so I've got this somewhere in my script: boolean showPaint=true; public void mousePressed(MouseEvent e) { Rectangle hideButton = new Rectangle(473,346,41,32); if(hideButton.contains(e.getPoint())) { showPaint = !showPaint; } } and in my onPaint there is this: if(showPaint){ //paint stuff }else{ //something else } But that doesnt work. Do i have to put the method mousePressed(MouseEvent e) somewhere else? cuz i've no clue what to do. Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted April 2, 2015 Share Posted April 2, 2015 Ok so I've got this somewhere in my script: boolean showPaint=true; public void mousePressed(MouseEvent e) { Rectangle hideButton = new Rectangle(473,346,41,32); if(hideButton.contains(e.getPoint())) { showPaint = !showPaint; } } and in my onPaint there is this: if(showPaint){ //paint stuff }else{ //something else } But that doesnt work. Do i have to put the method mousePressed(MouseEvent e) somewhere else? cuz i've no clue what to do. put a log inside of your event and see if it registers the mouse press. This is how you should start debugging. Start at a high level and work your way down seeing what works and what doesnt. Quote Link to comment Share on other sites More sharing options...
dokato Posted April 2, 2015 Author Share Posted April 2, 2015 put a log inside of your event and see if it registers the mouse press. This is how you should start debugging. Start at a high level and work your way down seeing what works and what doesnt. doesnt register, as expected Quote Link to comment Share on other sites More sharing options...
Mysteryy Posted April 2, 2015 Share Posted April 2, 2015 doesnt register, as expected What mouse event are you using. Did you override the client mouse event and or register a new listener? Quote Link to comment Share on other sites More sharing options...
dokato Posted April 2, 2015 Author Share Posted April 2, 2015 What mouse event are you using. Did you override the client mouse event and or register a new listener? all i have is what i posted + some imported thingy's: import java.awt.event.MouseEvent; import java.awt.event.MouseListener; //it says is not used Quote Link to comment Share on other sites More sharing options...
Extreme Scripts Posted April 2, 2015 Share Posted April 2, 2015 Need to have @Override public void mouseClicked(MouseEvent e){ //doshit } 1 Quote Link to comment Share on other sites More sharing options...
Botre Posted April 2, 2015 Share Posted April 2, 2015 (edited) you didn't actually add a mouse listener. Have a look at this thread: http://osbot.org/forum/topic/61861-adding-in-a-mouse-listener/?hl=mouselistener Good luck (Report back if you managed to figure it out:)) Edited April 2, 2015 by Botre 1 Quote Link to comment Share on other sites More sharing options...
dokato Posted April 2, 2015 Author Share Posted April 2, 2015 (edited) you didn't actually add a mouse listener. Have a look at this thread: http://osbot.org/forum/topic/61861-adding-in-a-mouse-listener/?hl=mouselistener Good luck (Report back if you managed to figure it out:)) W00t worx good now thanx alot man, i love u u2 Mysteryy Edited April 2, 2015 by dokato 1 Quote Link to comment Share on other sites More sharing options...