|
|
@ -96,13 +96,14 @@ public abstract class AbstractPopBox extends JPanel { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void mouseClick(MouseEvent evt) { |
|
|
|
private void mouseClick(MouseEvent evt) { |
|
|
|
int x = evt.getLocationOnScreen().x; |
|
|
|
Point point = new Point((int) (evt.getLocationOnScreen().getX()), (int) evt.getLocationOnScreen().getY()); |
|
|
|
int y = evt.getLocationOnScreen().y; |
|
|
|
Dimension popBoxD = AbstractPopBox.this.getSize(); |
|
|
|
Rectangle popBoxRect = AbstractPopBox.this.getBounds(); |
|
|
|
Point popBoxP = AbstractPopBox.this.getLocationOnScreen(); |
|
|
|
Rectangle rectangle = this.getControlWindow().getBounds(); |
|
|
|
Dimension popMenuD = this.getControlWindow().getSize(); |
|
|
|
boolean b1 = x < rectangle.x || x > rectangle.x + rectangle.width; |
|
|
|
Point popMenuP = this.getControlWindow().getLocation(); |
|
|
|
boolean b2 = y < rectangle.y - popBoxRect.height || y > rectangle.y + rectangle.height; |
|
|
|
Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); |
|
|
|
if (b1 || b2) { |
|
|
|
Rectangle popMenuRect = new Rectangle(popMenuP, popMenuD); |
|
|
|
|
|
|
|
if (!popBoxRect.contains(point) && !popMenuRect.contains(point)) { |
|
|
|
this.hidePopupMenu(); |
|
|
|
this.hidePopupMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|