From b28e268f04f0dbc6926ebfeb392c0720aa992c87 Mon Sep 17 00:00:00 2001 From: plough Date: Fri, 22 Feb 2019 16:54:42 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-14526=20=E3=80=900123=E5=9B=9E=E5=BD=92?= =?UTF-8?q?=E3=80=91=E6=96=87=E4=BB=B6=E6=8E=A7=E4=BB=B6=EF=BC=8C=E5=8F=AA?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8D=95=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=96=87=E5=AD=97=E8=A2=AB=E9=81=AE=E6=8C=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/utils/gui/UIComponentUtils.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java index 3e1f98555f..d2e9704658 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java @@ -2,6 +2,8 @@ package com.fr.design.utils.gui; import com.fr.design.gui.core.UITextComponent; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.stable.StringUtils; import javax.swing.JComponent; @@ -9,6 +11,7 @@ import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.util.Locale; /** * 包含 UI 组件相关的工具方法 @@ -45,15 +48,18 @@ public class UIComponentUtils { } private static void insertPrefixToText(UITextComponent comp, String prefix) { - if (comp == null) { + if (comp == null || ComparatorUtils.equals(Locale.CHINA, GeneralContext.getLocale())) { + // 最初是为了解决日文国际化显示不全,而增加的换行功能。中文不需要换行。 + // windows 下,字体为宋体时,对于 JLabel、JCheckBox、JButton 等控件,使用换行后,文字会下移,可能导致文字下半部分被截断。 + // 因此中文直接返回,不加换行逻辑。 return; } - String text = comp.getText(); - if (StringUtils.isEmpty(comp.getText()) || text.startsWith(HTML_TAG)) { + String text = comp.getText(); + if (StringUtils.isEmpty(text) || text.startsWith(HTML_TAG)) { return; } - comp.setText(prefix + comp.getText()); + comp.setText(prefix + text); } /**