Browse Source

REPORT-14057 10.0日文国际化问题处理=>问题4

bugfix/10.0
plough 6 years ago
parent
commit
d1620c1355
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  2. 12
      designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java

2
designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java

@ -61,6 +61,7 @@ public class PreferencePane extends BasicPane {
private static final int CACHING_MAX = 10;
private static final int CACHING_DEFAULT = 5;
private static final int CACHING_GAP = 5;
private static final int MEMORY_TIP_LABEL_MAX_WIDTH = 230;
private static final String TYPE = "pressed";
private static final String DISPLAY_TYPE = "+";
@ -472,6 +473,7 @@ public class PreferencePane extends BasicPane {
JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template"));
UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Max_Caching_Template"));
UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preference_Caching_Template_Tip"));
memoryTipLabel.setLineWrapWithMaximumWidth(MEMORY_TIP_LABEL_MAX_WIDTH);
memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0));
cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT);
JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout());

12
designer-base/src/main/java/com/fr/design/gui/ilable/UILabel.java

@ -64,6 +64,18 @@ public class UILabel extends JLabel {
return preferredSize;
}
/**
* 指定最大宽度文字内容到达最大宽度后自动换行
*/
public void setLineWrapWithMaximumWidth(int width) {
String text = this.getText();
if (StringUtils.isEmpty(text)) {
return;
}
String htmlText = "<html><body style='width: " + width + "px'>" + text;
this.setText(htmlText);
}
public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT);

Loading…
Cancel
Save