From db56ac4b603c1f2aa2a890bbd653d363c478adf8 Mon Sep 17 00:00:00 2001 From: dzmipt Date: Fri, 8 Dec 2023 17:51:05 +0100 Subject: [PATCH] do not add BLANK_ICON to actions by default (fix buttons in the Search panel) --- src/studio/ui/StudioWindow.java | 4 +++- src/studio/ui/UserAction.java | 10 +++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/studio/ui/StudioWindow.java b/src/studio/ui/StudioWindow.java index b789d9a0..d59679ca 100755 --- a/src/studio/ui/StudioWindow.java +++ b/src/studio/ui/StudioWindow.java @@ -711,7 +711,6 @@ private void initActions() { editor.setLineEnding(lineEnding); refreshActionState(); } ); - action.removeIcon(); lineEndingActions[lineEnding.ordinal()] = action; } @@ -852,6 +851,9 @@ private void addToMenu(JMenu menu, Action... actions) { if (action == null) { menu.addSeparator(); } else { + if (action.getValue(Action.SMALL_ICON) == null) { + action.putValue(Action.SMALL_ICON, Util.BLANK_ICON); + } menu.add(action); } } diff --git a/src/studio/ui/UserAction.java b/src/studio/ui/UserAction.java index 308baeee..96b44309 100755 --- a/src/studio/ui/UserAction.java +++ b/src/studio/ui/UserAction.java @@ -16,10 +16,6 @@ public UserAction(String text, putValue(ACCELERATOR_KEY,key); } - public void removeIcon() { - putValue(SMALL_ICON, null); - } - public String getText() { return (String)getValue(NAME); } @@ -46,16 +42,16 @@ public void setSelected(boolean value) { public static UserAction create(String text, String desc, int mnemonic, KeyStroke key, ActionListener listener) { - return create(text, Util.BLANK_ICON, desc, mnemonic, key, listener); + return create(text, null, desc, mnemonic, key, listener); } public static UserAction create(String text, String desc, int mnemonic, ActionListener listener) { - return create(text, Util.BLANK_ICON, desc, mnemonic, null, listener); + return create(text, null, desc, mnemonic, null, listener); } public static UserAction create(String text, ActionListener listener) { - return create(text, Util.BLANK_ICON, null, 0, null, listener); + return create(text, null, null, 0, null, listener); } }