Jump to content

show/hide paint problem


dokato

Recommended Posts

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.
 
 
Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

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 smile.png

 

(Report back if you managed to figure it out:))

 

W00t worx good now biggrin.png thanx alot man, i love u

u2  Mysteryy

Edited by dokato
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...