Browse Source

REPORT-817 改个写法

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

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

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

Loading…
Cancel
Save