Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem hiding/showing paint.

Featured Replies

I am trying to hide/show my paint with the click of an area on the paint. My code is as follows:

 

public void mouseClicked(MouseEvent e) {
log("Clicked somewhere");
        Point clicked;
        Rectangle PaintButton = new Rectangle(475, 350, 19, 18);
        clicked = e.getPoint();
        if (PaintButton.contains(clicked) && !ShowPaint) {
        log("Showing paint");
            ShowPaint = true;
        } else if (PaintButton.contains(clicked) && ShowPaint) {
        log("Hiding paint");
            ShowPaint = false;
        }
 
    }
 
The paint will not toggle as I wish, any help is appreciated.

 

Did the method you used print out anything at all?

try to use Mousereleased or Mousepressed instead smile.png

 

Try this:

public void mousePressed(MouseEvent e) {
    Point clicked = e.getPoint();;
    Rectangle paintButton = new Rectangle(475, 350, 19, 18);
    if (paintButton.contains(clicked))
        showPaint = !showPaint;
    
}

This just reverses the ShowPaint boolean.

 

in the onPaint method in you do the folowing:

public void onPaint(Graphics2D g){

   if(showPaint){
       //draw your paint :)

   }else{

      //draw a "X" or image so pll know where to click again on unhide it the paint

   }

}

 

PS: try the folow java conventions, they will make it easier to read for other people ^^

A variable starts with a "lowerCase" letter.

 

You can always pm me on skype when you got more questions!

 

Khaleesi

Edited by Khaleesi

I'll show you how to do it when I'm home, you have to create a mouse action listener probably in your on start. I'll post here in 5hrs or so, if I don't just remind me

this.bot.addMouseListener(new java.awt.event.MouseListener() {




@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub


}


@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub


}


@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub


}


@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}


@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub


/*
* 
* GUI ON/OFF
* 
*/


 YOUR CODE HERE
}


});

MouseClicked = deprecated in OSbot 2, you need to attach your own mouseListener

 

Edited by denoxum

  • Author

Problem resolved, just had to add the listener since as you guys said mouseClicked is deprecated in Osbot 2.

Edited by Molly

Guest
This topic is now closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.