Skip to content

[GREENFOOT-178] Mouse not updated when buttons other than left-button is pressed

When dragging the mouse around with the 2nd or 3rd button pressed, a MouseInfo object is not returned from Greenfoot.getMouseInfo().

Put this code into a world class:

  • public void act() {
    MouseInfo mouse = Greenfoot.getMouseInfo(); if(mouse != null) {

      GreenfootImage img = getBackground();
      img.clear();
      img.setColor(java.awt.Color.BLACK);
          int x = mouse.getX();
          int y = mouse.getY();
          img.drawString("x: " + x + ", y: " + y, 100, 100);
      }

    }


Issue metadata

  • Issue type: Bug
  • Priority: Medium
  • Fix versions: 1.5.0