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 {