This site requires JavaScript, please enable it in your browser!
Greenfoot back
Roshan123
Roshan123 wrote ...

2021/6/5

getButton method

Roshan123 Roshan123

2021/6/5

#
What is the use of getButton() and how does it works? What read api but i can't understand (
danpost danpost

2021/6/5

#
Mainly, it tells you which mouse button was used. For example of use:
1
2
3
4
5
6
7
8
if (Greenfoot.mouseClicked(this))
{
    switch (Greenfoot.getMouseInfo().getButton())
    {
        case 1 : ; /* do something */ break;
        case 3 : ; /* do something else */ break;
    }
}
Gbasire Gbasire

2021/6/5

#
the getButton method cannot be used on web, as it cannot be converted in the html5 version on the website
Roshan123 Roshan123

2021/6/5

#
Oh, ok. Thanks to both of u for helping me out)
You need to login to post a reply.