From c633c8f8aa295f72ad7249fdfdcad0def3bcfe7a Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 23 Nov 2022 09:58:59 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-84428=20=E8=AE=BE=E7=BD=AE=E5=83=8F&?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=86=85=E5=AE=B9=E9=A2=91=E7=B9=81=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=BC=9A=E5=87=BA=E7=8E=B0=E7=A9=BA=E7=99=BD=E6=88=96?= =?UTF-8?q?=E5=85=A8=E9=80=89=E7=9A=84=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../replace/ui/ITReplaceWestPanel.java | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java index 1c9ed16523..a01fa3909e 100644 --- a/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java +++ b/designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java @@ -14,11 +14,11 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JPanel; import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; import java.awt.Color; import java.awt.Cursor; import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.util.List; @@ -49,31 +49,28 @@ public class ITReplaceWestPanel { contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content")); settingButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Replace_Setting")); contentButton.setText(CONTENT_TEXT); - contentButton.addActionListener(new ActionListener() { + contentButton.addChangeListener(new ChangeListener() { @Override - public void actionPerformed(ActionEvent e) { - if (!contentButton.isSelected()) { + public void stateChanged(ChangeEvent e) { + if (contentButton.isSelected()) { showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList()); + settingButton.setSelected(!contentButton.isSelected()); + changeColor4SelectContent(); } else { - showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList()); + contentButton.setSelected(true); } - changeColor4SelectContent(); - settingButton.setSelected(contentButton.isSelected()); - } }); - - settingButton.addActionListener(new ActionListener() { + settingButton.addChangeListener(new ChangeListener() { @Override - public void actionPerformed(ActionEvent e) { - if (!settingButton.isSelected()) { + public void stateChanged(ChangeEvent e) { + if (settingButton.isSelected()) { showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList()); + contentButton.setSelected(!settingButton.isSelected()); + changeColor4SelectContent(); } else { - showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList()); + settingButton.setSelected(true); } - changeColor4SelectContent(); - contentButton.setSelected(settingButton.isSelected()); - } }); leftPanel.setBackground(Color.WHITE); @@ -118,7 +115,7 @@ public class ITReplaceWestPanel { * 切换面板时改变颜色 */ public void changeColor4SelectContent() { - if (!contentButton.isSelected()) { + if (contentButton.isSelected()) { contentButton.setText(CONTENT_TEXT); settingButton.setText(Toolkit.i18nText("Fine-Design_Replace_Setting")); } else {