You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
3.8 KiB
111 lines
3.8 KiB
4 years ago
|
From 1df5af6bc3c3b9f6223b569479b3ca520a746561 Mon Sep 17 00:00:00 2001
|
||
|
From: Yvan <Yvan@fanruan.com>
|
||
|
Date: Fri, 18 Dec 2020 09:49:13 +0800
|
||
|
Subject: [PATCH] =?UTF-8?q?REPORT-42238=20=E3=80=9010.0.13=E3=80=91JDK11?=
|
||
|
=?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=9B=BE=E6=A0=87=E6=A8=A1=E7=B3=8A?=
|
||
|
=?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96=20No.2:=E6=8F=90=E4=BA=A4U?=
|
||
|
=?UTF-8?q?pdateAction?=
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
---
|
||
|
.../com/fr/design/actions/UpdateAction.java | 41 ++++++++++++++++++-
|
||
|
1 file changed, 40 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
|
||
|
index 4fd7e6c42..c284b9d56 100644
|
||
|
--- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
|
||
|
+++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java
|
||
|
@@ -78,6 +78,16 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
|
||
|
private String searchText = StringUtils.EMPTY;
|
||
|
|
||
|
+ /**
|
||
|
+ * 按钮在按压状态的图标key
|
||
|
+ */
|
||
|
+ public static final String PRESSED_ICON = "pressedIcon";
|
||
|
+
|
||
|
+ /**
|
||
|
+ * 按钮在灰化状态的图标key
|
||
|
+ */
|
||
|
+ public static final String DISABLED_ICON = "disabledIcon";
|
||
|
+
|
||
|
|
||
|
|
||
|
/**
|
||
|
@@ -251,6 +261,14 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
|
||
|
}
|
||
|
|
||
|
+ public void setPressedIcon(Icon pressedIcon) {
|
||
|
+ this.putValue(UpdateAction.PRESSED_ICON, pressedIcon);
|
||
|
+ }
|
||
|
+
|
||
|
+ public void setDisabledIcon(Icon disabledIcon) {
|
||
|
+ this.putValue(UpdateAction.DISABLED_ICON, disabledIcon);
|
||
|
+ }
|
||
|
+
|
||
|
@Override
|
||
|
public synchronized void addPropertyChangeListener(PropertyChangeListener listener) {
|
||
|
|
||
|
@@ -271,6 +289,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
UIMenuItem menuItem = new UIMenuItem(this);
|
||
|
// 设置名字用作单元测
|
||
|
menuItem.setName(getName());
|
||
|
+ setPressedIcon4Button(menuItem);
|
||
|
+ setDisabledIcon4Button(menuItem);
|
||
|
object = menuItem;
|
||
|
|
||
|
this.putValue(UIMenuItem.class.getName(), object);
|
||
|
@@ -282,6 +302,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
UIMenuEastAttrItem menuItem = new UIMenuEastAttrItem(this);
|
||
|
// 设置名字用作单元测
|
||
|
menuItem.setName(getName());
|
||
|
+ setPressedIcon4Button(menuItem);
|
||
|
+ setDisabledIcon4Button(menuItem);
|
||
|
this.putValue(UIMenuItem.class.getName(), menuItem);
|
||
|
return menuItem;
|
||
|
}
|
||
|
@@ -307,6 +329,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
}
|
||
|
|
||
|
button.setIcon((Icon) this.getValue(Action.SMALL_ICON));
|
||
|
+ setPressedIcon4Button(button);
|
||
|
+ setDisabledIcon4Button(button);
|
||
|
button.addActionListener(this);
|
||
|
|
||
|
button.registerKeyboardAction(this, this.getAccelerator(), JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||
|
@@ -454,6 +478,8 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
object = new UseMenuItem(this);
|
||
|
this.putValue(UseMenuItem.class.getName(), object);
|
||
|
}
|
||
|
+ setPressedIcon4Button((UseMenuItem) object);
|
||
|
+ setDisabledIcon4Button((UseMenuItem) object);
|
||
|
return (UseMenuItem) object;
|
||
|
}
|
||
|
|
||
|
@@ -594,4 +620,17 @@ public abstract class UpdateAction extends ShortCut implements Action {
|
||
|
shortPinyin.append(PinyinHelper.getShortPinyin(title)).append(separator);
|
||
|
}
|
||
|
|
||
|
-}
|
||
|
\ No newline at end of file
|
||
|
+ private void setPressedIcon4Button(AbstractButton button) {
|
||
|
+ Icon pressedIcon = (Icon) this.getValue(UpdateAction.PRESSED_ICON);
|
||
|
+ if (pressedIcon != null) {
|
||
|
+ button.setPressedIcon(pressedIcon);
|
||
|
+ }
|
||
|
+ }
|
||
|
+
|
||
|
+ private void setDisabledIcon4Button(AbstractButton button) {
|
||
|
+ Icon disabledIcon = (Icon) this.getValue(UpdateAction.DISABLED_ICON);
|
||
|
+ if (disabledIcon != null) {
|
||
|
+ button.setDisabledIcon(disabledIcon);
|
||
|
+ }
|
||
|
+ }
|
||
|
+}
|
||
|
--
|
||
|
2.24.1
|
||
|
|