diff --git a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java index 3ef72242a7..d8234c2b1d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/EditingMouseListener.java @@ -79,6 +79,9 @@ public class EditingMouseListener extends MouseInputAdapter { //备份开始拖动的位置和大小 private Rectangle dragBackupBounds; + private int pressX; + private int pressY; + /** * 获取最小移动距离 * @@ -141,6 +144,8 @@ public class EditingMouseListener extends MouseInputAdapter { public void mousePressed(MouseEvent e) { int oldX = e.getX(); int oldY = e.getY(); + pressX = oldX; + pressY = oldY; offsetEventPoint(e); if (!stopEditing()) { return; @@ -189,6 +194,7 @@ public class EditingMouseListener extends MouseInputAdapter { * @param e 鼠标事件 */ public void mouseReleased(MouseEvent e) { + MouseEvent transEvent = new MouseEvent(e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), e.getButton()); int oldX = e.getX(); int oldY = e.getY(); offsetEventPoint(e); @@ -213,6 +219,12 @@ public class EditingMouseListener extends MouseInputAdapter { lastPressEvent = null; lastXCreator = null; e.translatePoint(oldX - e.getX(), oldY - e.getY()); + if (pressX != oldX || pressY != oldY) { + // click只有在mouseReleased和mousePressed前后x/y坐标相等时才会被触发在mouseReleased之后 + // 但是当使用者来回点击切换时 存在mouseReleased和mousePressed前后x/y坐标不相等的情况 即鼠标按下去的位置和鼠标释放的位置不相等 存在偏移 + // 当这种偏移很小时 看起来就好像是点击了 实际上是手抖了或者鼠标轻微滑动了 所以这里对这种情况要有容错处理 + mouseClicked(transEvent); + } } private void mouseDraggingRelease(MouseEvent e) { diff --git a/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java b/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java index e3d5f46e4e..ddab3a305e 100644 --- a/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java +++ b/designer-form/src/main/java/com/fr/design/parameter/ParameterPropertyPane.java @@ -1,5 +1,6 @@ package com.fr.design.parameter; +import com.fr.base.Parameter; import com.fr.design.constants.UIConstants; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWParameterLayout; @@ -124,7 +125,8 @@ public class ParameterPropertyPane extends JPanel{ hideInJForm = jt instanceof JForm && !(creator instanceof XWParameterLayout || creator.getParent() instanceof XWParameterLayout); } catch (NullPointerException ex) { - hideInJForm = toolbarPane.updateBean().length <= 0; + Parameter[] parameters = toolbarPane.updateBean(); + hideInJForm = parameters == null || parameters.length <= 0; } if (isVisible && toolbarPane.hasSelectedLabelItem() && !hideInJForm) { addParaPane.setVisible(true);