diff --git a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java index 8b727e099..1d66094f1 100644 --- a/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java +++ b/designer-base/src/main/java/com/fr/design/style/AbstractSelectBox.java @@ -10,16 +10,20 @@ import java.awt.RenderingHints; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import javax.swing.AbstractButton; import javax.swing.JPanel; import javax.swing.border.AbstractBorder; import javax.swing.event.AncestorEvent; import javax.swing.event.AncestorListener; +import javax.swing.plaf.ButtonUI; import com.fr.design.constants.UIConstants; -import com.fr.design.gui.ibutton.UIToggleButton; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.stable.Constants; +import com.fr.design.utils.gui.GUIPaintUtils; import com.fr.design.style.background.BackgroundJComponent; +import com.fr.stable.Constants; /** * @author kunsnat E-mail:kunsnat@gmail.com @@ -29,7 +33,7 @@ import com.fr.design.style.background.BackgroundJComponent; public abstract class AbstractSelectBox extends AbstractPopBox implements MouseListener { private static final long serialVersionUID = 2355250206956896774L; - private UIToggleButton triggleButton; + private UIButton triggleButton; protected void initBox(int preWidth) { this.setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -37,8 +41,34 @@ public abstract class AbstractSelectBox extends AbstractPopBox implements Mou displayComponent = new BackgroundJComponent(); displayComponent.setEmptyBackground(); displayComponent.setBorder(new TriggleLineBorder()); - triggleButton = new UIToggleButton(UIConstants.ARROW_DOWN_ICON); + triggleButton = new UIButton(UIConstants.ARROW_DOWN_ICON) { + public boolean shouldResponseChangeListener() { + return false; + } + + @Override + public ButtonUI getUI() { + return new UIButtonUI() { + @Override + protected boolean isPressed(AbstractButton b) { + return model.isArmed() && model.isPressed(); + } + + @Override + protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) { + if (isPressed(b) && b.isPressedPainted()) { + GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), UIConstants.COMBOBOX_BTN_PRESS); + } else if (isRollOver(b)) { + GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_ROLLOVER); + } else if (b.isNormalPainted()) { + GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), UIConstants.COMBOBOX_BTN_NORMAL); + } + } + }; + } + }; triggleButton.setPreferredSize(new Dimension(20, 20)); + triggleButton.setRoundBorder(true, Constants.LEFT); JPanel displayPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); displayPane.add(displayComponent, BorderLayout.CENTER); diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java index c0ad60ad4..3144e572f 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/LayoutStylePane.java @@ -215,6 +215,15 @@ public class LayoutStylePane extends BasicBeanPane { titleTextPane = new TinyFormulaPane(); titleFontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); + TitlePacker title = style.getTitle(); + if (title != null) { + FRFont frFont = title.getFrFont(); + if (frFont != null) { + String fontFamily = frFont.getFamily(); + // 使用style中默认的字体初始化titleFontFamilyComboBox,保证UI和数据的一致性 + this.titleFontFamilyComboBox.setSelectedItem(fontFamily); + } + } titleFontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); titleFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);