Jump to content

show/hide paint problem


Recommended Posts

Posted

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

 

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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