From d72aeba63df4b06abcc6a75e8435a3b099972d98 Mon Sep 17 00:00:00 2001 From: fr_shine Date: Tue, 22 Nov 2016 17:14:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E5=9D=90=E6=A0=87=E8=BD=B4?= =?UTF-8?q?=20=E5=B8=B8=E8=A7=84=E9=A1=B9=E8=A6=81=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=88=90=E8=87=AA=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/style/FormatPane.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/designer_base/src/com/fr/design/gui/style/FormatPane.java b/designer_base/src/com/fr/design/gui/style/FormatPane.java index c0591fe56..cce2de78c 100644 --- a/designer_base/src/com/fr/design/gui/style/FormatPane.java +++ b/designer_base/src/com/fr/design/gui/style/FormatPane.java @@ -4,10 +4,10 @@ import com.fr.base.CoreDecimalFormat; import com.fr.base.GraphHelper; import com.fr.base.Style; import com.fr.base.TextFormat; -import com.fr.design.constants.UIConstants; import com.fr.data.core.FormatField; import com.fr.data.core.FormatField.FormatContents; import com.fr.design.border.UIRoundedBorder; +import com.fr.design.constants.UIConstants; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBoxRenderer; import com.fr.design.gui.icontainer.UIScrollPane; @@ -81,16 +81,7 @@ public class FormatPane extends AbstractBasicStylePane { }; typeComboBox = new UIComboBox(types); - UIComboBoxRenderer render = new UIComboBoxRenderer() { - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - if (value instanceof Integer) { - label.setText(" " + FormatField.getInstance().getName((Integer) value)); - } - return label; - } - }; + UIComboBoxRenderer render = createComBoxRender(); typeComboBox.setRenderer(render); typeComboBox.addItemListener(itemListener); contentPane.add(sampleLabel, BorderLayout.NORTH); @@ -114,6 +105,18 @@ public class FormatPane extends AbstractBasicStylePane { } + protected UIComboBoxRenderer createComBoxRender(){ + return new UIComboBoxRenderer() { + @Override + public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { + JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + if (value instanceof Integer) { + label.setText(" " + FormatField.getInstance().getName((Integer) value)); + } + return label; + } + }; + } private void iniSampleLable() { Border innterborder = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4);