From 54bf5da257119cf2f2be2b2712f580c82d6d08f4 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 18:42:05 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E4=BF=AE=E5=A4=8D=E5=9C=A8=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E6=97=A0=E6=B3=95=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E9=A2=9C=E8=89=B2=E6=8B=BE=E5=8F=96=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/style/color/ColorPicker.java | 4 ++++ .../src/com/fr/design/style/color/ColorSelectBox.java | 1 + 2 files changed, 5 insertions(+) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index 6fc5706037..c103e84371 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -32,6 +32,7 @@ public class ColorPicker extends JDialog implements ActionListener private ColorSelectable colorSelectable; private Point mousePos; // 鼠标的绝对坐标 private Color colorToSet; // 暂存要设置的颜色值 + private Color initColor; // 保存初始颜色。实时模式下,如果取消取色操作,则重设为初始颜色 private Boolean setColorRealTime; // 实时设定颜色值 @@ -66,6 +67,7 @@ public class ColorPicker extends JDialog implements ActionListener // 如果要求实时变化,确保先关闭弹窗,再截屏 // 主要针对"图案"选项卡中的"前景"、"背景" if (this.setColorRealTime) { + initColor = colorSelectable.getColor(); colorSelectable.setColor(Color.WHITE); // setColor 可以关闭弹窗 try { Thread.sleep(100); // 等待弹窗关闭 @@ -114,6 +116,8 @@ public class ColorPicker extends JDialog implements ActionListener timer.stop(); if (setColor) { colorSelectable.setColor(colorToSet); + } else if (setColorRealTime) { + colorSelectable.setColor(initColor); } this.dispose(); } diff --git a/designer_base/src/com/fr/design/style/color/ColorSelectBox.java b/designer_base/src/com/fr/design/style/color/ColorSelectBox.java index f926775ee1..2dd5d51c39 100644 --- a/designer_base/src/com/fr/design/style/color/ColorSelectBox.java +++ b/designer_base/src/com/fr/design/style/color/ColorSelectBox.java @@ -63,6 +63,7 @@ public class ColorSelectBox extends AbstractSelectBox implements UIObserv fireDisplayComponent(ColorBackground.getInstance(color)); } }); + colorPane.setColor(color); return colorPane; } From e596f2aca760cd2f7c700c00d603c7861aaa8571 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 3 Jan 2017 19:43:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-1096=20=E5=8F=96=E8=89=B2=E6=9D=BF?= =?UTF-8?q?=3D=E3=80=8B=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/style/color/ColorPicker.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/designer_base/src/com/fr/design/style/color/ColorPicker.java b/designer_base/src/com/fr/design/style/color/ColorPicker.java index c103e84371..e616e08af7 100644 --- a/designer_base/src/com/fr/design/style/color/ColorPicker.java +++ b/designer_base/src/com/fr/design/style/color/ColorPicker.java @@ -112,12 +112,10 @@ public class ColorPicker extends JDialog implements ActionListener validate(); // 更新所有子控件 } - public void pickComplete(Boolean setColor) { + public void pickComplete(Color color) { timer.stop(); - if (setColor) { - colorSelectable.setColor(colorToSet); - } else if (setColorRealTime) { - colorSelectable.setColor(initColor); + if (color != null) { + colorSelectable.setColor(color); } this.dispose(); } @@ -134,9 +132,9 @@ public class ColorPicker extends JDialog implements ActionListener public void mousePressed(MouseEvent e) { if (e.getButton() == e.BUTTON1) { // 左键确定 - pickComplete(true); + pickComplete(colorToSet); } else { - pickComplete(false); + pickComplete(setColorRealTime ? initColor : null); } } }