Browse Source

REPORT-23943 进入参数面板,点击预定义控件,弹框无法缩回

feature/big-screen
pengda 5 years ago
parent
commit
1b936122d0
  1. 35
      designer-form/src/main/java/com/fr/design/mainframe/FormWidgetPopWindow.java

35
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();

Loading…
Cancel
Save