Browse Source

REPORT-817 改个写法

master
vito 8 years ago
parent
commit
d0e7f6b405
  1. 15
      designer_base/src/com/fr/design/style/AbstractPopBox.java

15
designer_base/src/com/fr/design/style/AbstractPopBox.java

@ -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();
} }
} }

Loading…
Cancel
Save