diff --git a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java index 0f5e629e2..d53232416 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java +++ b/designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java @@ -8,11 +8,16 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; - -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable { centerPane.add(Box.createVerticalStrut(1)); // mod by anchore 16/11/16 - UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); + final UIButton customButton = new UIButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_More_Color")); - customButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的"更多颜色"按钮会有问题(REPORT-13654) + customButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!customButton.isEnabled()) { + return; + } customButtonPressed(); } }); diff --git a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java index 67d99819d..f394801c8 100644 --- a/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java +++ b/designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java @@ -4,11 +4,15 @@ import com.fr.base.BaseUtils; import com.fr.design.gui.ibutton.SpecialUIButton; import com.fr.design.gui.ibutton.UIBasicButtonUI; -import javax.swing.*; -import javax.swing.plaf.ButtonUI; -import javax.swing.plaf.basic.BasicButtonUI; -import java.awt.*; -import java.awt.event.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; /** * Created by plough on 2016/12/22. @@ -28,7 +32,7 @@ class PickColorButtonFactory { * @return SpecialUIButton 屏幕取色按钮 */ static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { - SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); + final SpecialUIButton pickColorButton = new SpecialUIButton(new WhiteButtonUI()); PickColorButtonFactory.iconType = iconType; if (iconType == IconType.ICON16) { @@ -42,9 +46,13 @@ class PickColorButtonFactory { pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); - pickColorButton.addActionListener(new ActionListener() { + // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654) + pickColorButton.addMouseListener(new MouseAdapter() { @Override - public void actionPerformed(ActionEvent e) { + public void mousePressed(MouseEvent e) { + if (!pickColorButton.isEnabled()) { + return; + } new ColorPicker(colorSelectable, setColorRealTime); } });