diff --git a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java index 1acf4a4042..5023e6f4f1 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java +++ b/designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java @@ -3,6 +3,7 @@ */ package com.fr.design.actions.cell.style; +import com.fr.stable.os.OperatingSystem; import java.awt.Dimension; import javax.swing.ComboBoxModel; @@ -49,6 +50,7 @@ public class ReportFontNameAction extends AbstractStyleAction { public void setFontName(String fontName) { Object object = this.getValue(UIComboBox.class.getName()); + boolean find = false; if (object != null && object instanceof UIComboBox) { UIComboBox comboBox = (UIComboBox) object; ComboBoxModel comboBoxModel = comboBox.getModel(); @@ -60,9 +62,17 @@ public class ReportFontNameAction extends AbstractStyleAction { comboBox.removeActionListener(this); comboBox.setSelectedIndex(i); comboBox.addActionListener(this); + find = true; break; } } + // linux设计器下面 找不到默认就是第一个字体 + boolean access = OperatingSystem.isLinux() && !find && comboBoxModel.getSize() > 0; + if (access) { + comboBox.removeActionListener(this); + comboBox.setSelectedIndex(0); + comboBox.addActionListener(this); + } } }