|
|
@ -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 d = AbstractPopBox.this.getSize(); |
|
|
|
Rectangle popBoxRect = AbstractPopBox.this.getBounds(); |
|
|
|
Point p = AbstractPopBox.this.getLocationOnScreen(); |
|
|
|
Rectangle rectangle = this.getControlWindow().getBounds(); |
|
|
|
Dimension popBoxD = this.getControlWindow().getSize(); |
|
|
|
boolean b1 = x < rectangle.x || x > rectangle.x + rectangle.width; |
|
|
|
Point popBoxP = this.getControlWindow().getLocation(); |
|
|
|
boolean b2 = y < rectangle.y - popBoxRect.height || y > rectangle.y + rectangle.height; |
|
|
|
Rectangle rect = new Rectangle(p, d); |
|
|
|
if (b1 || b2) { |
|
|
|
Rectangle popBoxRect = new Rectangle(popBoxP, popBoxD); |
|
|
|
|
|
|
|
if (!rect.contains(point) && !popBoxRect.contains(point)) { |
|
|
|
this.hidePopupMenu(); |
|
|
|
this.hidePopupMenu(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|