diff --git a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java index ad9151fdbc..e43e4f48df 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java +++ b/designer-base/src/main/java/com/fr/design/gui/ibutton/UICombinationButton.java @@ -3,8 +3,7 @@ package com.fr.design.gui.ibutton; import javax.swing.Icon; import javax.swing.JPanel; import java.awt.BorderLayout; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; +import java.awt.event.ActionEvent; import java.util.function.Consumer; import static com.fine.theme.utils.FineClientProperties.BUTTON_BORDER; @@ -33,8 +32,8 @@ public class UICombinationButton extends JPanel { protected UIButton rightButton; - private Consumer leftClickLister; - private Consumer rightClickLister; + private Consumer leftClickLister; + private Consumer rightClickLister; protected void leftButtonClickEvent() { // 左边按钮点击事件 @@ -54,7 +53,7 @@ public class UICombinationButton extends JPanel { * * @param lister 监听 */ - public void addLeftClickLister(Consumer lister) { + public void addLeftActionListener(Consumer lister) { this.leftClickLister = lister; } @@ -63,7 +62,7 @@ public class UICombinationButton extends JPanel { * * @param lister 监听 */ - public void addRightClickLister(Consumer lister) { + public void addRightActionListener(Consumer lister) { this.rightClickLister = lister; } @@ -73,25 +72,18 @@ public class UICombinationButton extends JPanel { leftButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_LEFT_ROUND_RECT); rightButton = right; rightButton.putClientProperty(BUTTON_BORDER, BUTTON_BORDER_RIGHT_ROUND_RECT); - leftButton.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent e) { - if (leftClickLister != null) { - leftClickLister.accept(e); - } else { - leftButtonClickEvent(); - } + leftButton.addActionListener(e -> { + if (leftClickLister != null) { + leftClickLister.accept(e); + } else { + leftButtonClickEvent(); } }); - rightButton.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - if (rightClickLister != null) { - rightClickLister.accept(e); - } else { - rightButtonClickEvent(); - } + rightButton.addActionListener(e -> { + if (rightClickLister != null) { + rightClickLister.accept(e); + } else { + rightButtonClickEvent(); } }); diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 18d1aab0a4..17595c25bb 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -22,7 +22,6 @@ import com.fr.design.fun.MenuHandler; import com.fr.design.fun.OemProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UICombinationButton; -import com.fr.design.gui.ibutton.UISaveForbiddenButton; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.i18n.Toolkit; @@ -339,14 +338,14 @@ public class MainDesigner extends BaseDesigner { private UICombinationButton createRunButton() { run = new UICombinationButton(new UIButton(Toolkit.i18nText("Fine-Design_Basic_Preview"), new LazyIcon("run").white()), new UIButton(new LazyIcon("triangle_down").white())); - run.addLeftClickLister(mouseEvent -> { + run.addLeftActionListener(event -> { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (jt == null || jt.isSaving()) { return; } WebPreviewUtils.preview(jt); }); - run.addRightClickLister(mouseEvent -> { + run.addRightActionListener(event -> { final JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (jt == null) { return;