From 1b936122d0bd92763e207a70250635f2a116b2c2 Mon Sep 17 00:00:00 2001 From: pengda Date: Tue, 26 Nov 2019 10:31:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-23943=20=E8=BF=9B=E5=85=A5=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=9D=A2=E6=9D=BF=EF=BC=8C=E7=82=B9=E5=87=BB=E9=A2=84?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=8E=A7=E4=BB=B6=EF=BC=8C=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=BC=A9=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/mainframe/FormWidgetPopWindow.java | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java index fc3967a99..7f1304d3a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java @@ -12,14 +12,11 @@ import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.AWTEventListener; import java.awt.event.MouseEvent; - import javax.swing.JPanel; import javax.swing.JWindow; - import com.fr.design.constants.UIConstants; -import com.fr.design.designer.beans.location.Location; import com.fr.design.gui.core.WidgetOption; -import com.fr.stable.OperatingSystem; +import com.fr.stable.os.OperatingSystem; //august: public class FormWidgetPopWindow extends JWindow { @@ -52,24 +49,28 @@ public class FormWidgetPopWindow extends JWindow { if (event instanceof MouseEvent) { MouseEvent mv = (MouseEvent) event; if (mv.getClickCount() > 0) { - Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); - if (OperatingSystem.isWindows()) { - if(!FormWidgetPopWindow.this.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - } else if (OperatingSystem.isMacOS()) { - Dimension d = FormWidgetPopWindow.this.getSize(); - Point p = FormWidgetPopWindow.this.getLocation(); - Rectangle rect = new Rectangle(p, d); - if (!rect.contains(point)) { - FormWidgetPopWindow.this.setVisible(false); - } - } + hideWindow(mv); } } } }; + private void hideWindow(MouseEvent mv){ + Point point = new Point((int) (mv.getLocationOnScreen().getX()), (int) mv.getLocationOnScreen().getY()); + if (OperatingSystem.isWindows()) { + if (!FormWidgetPopWindow.this.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + }else if(OperatingSystem.isMacos() || OperatingSystem.isLinux()){ + Dimension d = FormWidgetPopWindow.this.getSize(); + Point p = FormWidgetPopWindow.this.getLocation(); + Rectangle rect = new Rectangle(p, d); + if (!rect.contains(point)) { + FormWidgetPopWindow.this.setVisible(false); + } + } + } + private class EditorChoosePane extends JPanel { public EditorChoosePane() { super();