From 5036dc94fe1b652cefec316d3eba484076d7934c Mon Sep 17 00:00:00 2001 From: obo Date: Tue, 5 Dec 2023 11:34:19 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-109335=20=E5=9B=9E=E9=80=80=E5=8E=9F?= =?UTF-8?q?=E6=96=B9=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FormulaPaneWhenReserveFormula.java | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java index 82efb8cd42..ab49b605d4 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPaneWhenReserveFormula.java @@ -7,11 +7,6 @@ import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.FontMetrics; /** * @author richie @@ -47,7 +42,6 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { checkBoxPane.add(reserveCheckBox4Result, BorderLayout.WEST); checkBoxPane.add(reserveCheckBox4Write, BorderLayout.WEST); - calculatePaneHeightWithCount(checkBoxPane); } @Override @@ -66,30 +60,4 @@ public class FormulaPaneWhenReserveFormula extends FormulaPane { } return formula; } - - - /** - * 计算一下公式面板textPane的实际高度 - * 目前已知英文国际化下文本较长,右侧check按钮无法正常展示,实际俄文有可能更长,因此写一个换行规则 - * 不影响中文效果 - * - * @param checkBoxPane textPane - */ - private void calculatePaneHeightWithCount(JPanel checkBoxPane) { - int componentsWidth = 0; - int currentPaneHeight = checkBoxPane.getPreferredSize().height; - int currentPaneWidth = checkBoxPane.getPreferredSize().width; - int hGap = ((FlowLayout) checkBoxPane.getLayout()).getHgap(); - for (Component component : checkBoxPane.getComponents()) { - if(component instanceof UICheckBox) { - Font font = component.getFont(); - FontMetrics fontMetrics = component.getFontMetrics(font); - int width = fontMetrics.stringWidth(((UICheckBox) component).getText()); - componentsWidth += width + hGap; - } - } - int count = (componentsWidth / currentPaneWidth) + 1; - int resultPaneHeight = count * currentPaneHeight; - checkBoxPane.setPreferredSize(new Dimension(currentPaneWidth, resultPaneHeight)); - } } \ No newline at end of file