Browse Source

REPORT-13654 测试系统换上12号的release后,调色板出不来了

bugfix/10.0
plough 6 years ago
parent
commit
42f0405e0c
  1. 21
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  2. 24
      designer-base/src/main/java/com/fr/design/style/color/PickColorButtonFactory.java

21
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.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.Box;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; 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.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -92,11 +97,15 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
centerPane.add(Box.createVerticalStrut(1)); centerPane.add(Box.createVerticalStrut(1));
// mod by anchore 16/11/16 // 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 @Override
public void actionPerformed(ActionEvent e) { public void mousePressed(MouseEvent e) {
if (!customButton.isEnabled()) {
return;
}
customButtonPressed(); customButtonPressed();
} }
}); });

24
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.SpecialUIButton;
import com.fr.design.gui.ibutton.UIBasicButtonUI; import com.fr.design.gui.ibutton.UIBasicButtonUI;
import javax.swing.*; import javax.swing.JButton;
import javax.swing.plaf.ButtonUI; import javax.swing.JComponent;
import javax.swing.plaf.basic.BasicButtonUI; import java.awt.Color;
import java.awt.*; import java.awt.Cursor;
import java.awt.event.*; 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. * Created by plough on 2016/12/22.
@ -28,7 +32,7 @@ class PickColorButtonFactory {
* @return SpecialUIButton 屏幕取色按钮 * @return SpecialUIButton 屏幕取色按钮
*/ */
static JButton getPickColorButton(final ColorSelectable colorSelectable, IconType iconType, final boolean setColorRealTime) { 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; PickColorButtonFactory.iconType = iconType;
if (iconType == IconType.ICON16) { if (iconType == IconType.ICON16) {
@ -42,9 +46,13 @@ class PickColorButtonFactory {
pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize)); pickColorButton.setPreferredSize(new Dimension(iconSize, iconSize));
pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR)); pickColorButton.setCursor(new Cursor(Cursor.HAND_CURSOR));
pickColorButton.addActionListener(new ActionListener() { // 不能使用 ActionListener,否则设计器工具栏中的取色按钮会有问题(REPORT-13654)
pickColorButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void mousePressed(MouseEvent e) {
if (!pickColorButton.isEnabled()) {
return;
}
new ColorPicker(colorSelectable, setColorRealTime); new ColorPicker(colorSelectable, setColorRealTime);
} }
}); });

Loading…
Cancel
Save