Esempio n. 1
0
 public void mouseDragged(MouseEvent e) {
   int x = e.getX();
   int y = e.getY();
   boolean oldMouseOverButton = mMouseOverButton;
   if (mPressedButton != -1) mMouseOverButton = mRect[mPressedButton].contains(x, y);
   if (mMouseOverButton ^ oldMouseOverButton) repaint();
 }
Esempio n. 2
0
 public void mousePressed(MouseEvent e) {
   int x = e.getX();
   int y = e.getY();
   for (int i = 0; mRect != null && i < mRect.length; i++) {
     if (mRect[i].contains(x, y)) {
       mPressedButton = i;
       mMouseOverButton = true;
       repaint();
     }
   }
 }