dokato Posted April 2, 2015 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.
Mysteryy Posted April 2, 2015 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.
dokato Posted April 2, 2015 Author 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
Mysteryy Posted April 2, 2015 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?
dokato Posted April 2, 2015 Author 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
Extreme Scripts Posted April 2, 2015 Posted April 2, 2015 Need to have @Override public void mouseClicked(MouseEvent e){ //doshit } 1
Botre Posted April 2, 2015 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
dokato Posted April 2, 2015 Author 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