From 9b8f88406762c4eb9b677cf50cd9e427d1b84707 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Mon, 16 Aug 2021 15:02:52 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-56929=20=E3=80=90FRM=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E3=80=91=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8?= =?UTF-8?q?-=E6=89=8B=E5=8A=A8=E9=97=B4=E8=B7=9D=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E7=9B=AE=E5=89=8D=E4=B8=8D=E6=94=AF=E6=8C=81=E5=9B=9E?= =?UTF-8?q?=E8=BD=A6=E8=A7=A6=E5=8F=91=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/ui/FormMultiWidgetCardPane.java | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java index fa9a9bd0b..699c34b2a 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/widget/ui/FormMultiWidgetCardPane.java @@ -26,6 +26,8 @@ import java.awt.BorderLayout; import java.awt.Component; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; public class FormMultiWidgetCardPane extends FormWidgetCardPane { private MultiSelectionArrangement arrangement; @@ -129,20 +131,8 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { TableLayout.PREFERRED, TableLayout.FILL }; - UITextField horizontalSpacingNumberField = new UIPositiveAndNegativeIntNumberField(); - horizontalSpacingNumberField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - distributionDoChange(horizontalSpacingNumberField.getText(), false); - } - }); - UITextField verticalSpacingNumberField = new UIPositiveAndNegativeIntNumberField(); - verticalSpacingNumberField.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - distributionDoChange(verticalSpacingNumberField.getText(), true); - } - }); + UITextField horizontalSpacingNumberField = createIntNumberField(false); + UITextField verticalSpacingNumberField = createIntNumberField(true); Component[][] components = new Component[][] { new Component[] { new UILabel(IOUtils.readIcon("/com/fr/design/images/buttonicon/multi_selection_horizontal_spacing.png")), @@ -157,6 +147,25 @@ public class FormMultiWidgetCardPane extends FormWidgetCardPane { return createTitleLayout(Toolkit.i18nText("Fine-Design_Multi_Selection_Manual_Spacing"), centerPane); } + private UIPositiveAndNegativeIntNumberField createIntNumberField(boolean isVertical) { + final UIPositiveAndNegativeIntNumberField intNumberField = new UIPositiveAndNegativeIntNumberField(); + intNumberField.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + distributionDoChange(intNumberField.getText(), isVertical); + } + }); + intNumberField.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_ENTER) { + distributionDoChange(intNumberField.getText(), isVertical); + } + } + }); + return intNumberField; + } + private void distributionDoChange(String text, boolean isVertical) { if (StableUtils.isNumber(text)) { if (isVertical) {