From cabdcd6a0907ae81fe4e2d530d261ddc36199740 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 1 Nov 2017 10:22:17 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-4946=20button=E7=9A=84=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/web/CustomIconPane.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/web/CustomIconPane.java b/designer_base/src/com/fr/design/web/CustomIconPane.java index 925fb3e34..dbf4b37b8 100644 --- a/designer_base/src/com/fr/design/web/CustomIconPane.java +++ b/designer_base/src/com/fr/design/web/CustomIconPane.java @@ -52,6 +52,10 @@ public class CustomIconPane extends BasicPane { private UIScrollPane jsPane; // 老一次次去拿真麻烦 private IconManager iconManager = null; + private UIButton removeButton; + private UIButton editButton; + + private static final int THE_WIDTH = 180; private static final int HORIZONTAL_COUNT = 6; @@ -151,7 +155,7 @@ public class CustomIconPane extends BasicPane { } private void initRemoveButton(JPanel buttonPane) { - UIButton removeButton = new UIButton(Inter.getLocText("FR-Designer_Remove")); + removeButton = new UIButton(Inter.getLocText("FR-Designer_Remove")); removeButton.setPreferredSize(new Dimension(80, 25)); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -180,7 +184,7 @@ public class CustomIconPane extends BasicPane { } private void initEditButton(JPanel buttonPane) { - UIButton editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); + editButton = new UIButton(Inter.getLocText("FR-Designer_Edit")); editButton.setPreferredSize(new Dimension(80, 25)); editButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -221,12 +225,21 @@ public class CustomIconPane extends BasicPane { JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Custom_Icon_Message2"), Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.WARNING_MESSAGE); } } - }); - edit.setVisible(true); + }).setVisible(true); } }); buttonPane.add(editButton); } + + private void updateButtonPane() { + if (iconManager.isSystemIcon(selectedIconName)) { + editButton.setEnabled(false); + removeButton.setEnabled(false); + } else { + editButton.setEnabled(true); + removeButton.setEnabled(true); + } + } @Override protected String title4PopupWindow() { @@ -263,6 +276,7 @@ public class CustomIconPane extends BasicPane { return; } this.selectedIconName = iconName; + updateButtonPane(); this.repaint(); } @@ -284,6 +298,7 @@ public class CustomIconPane extends BasicPane { } catch (RuntimeException re) { return; } + updateButtonPane(); } private class IconButton extends JToggleButton implements ActionListener{ @@ -336,6 +351,7 @@ public class CustomIconPane extends BasicPane { CustomIconPane.this.selectedIconName = iconName; fireChagneListener(); + updateButtonPane(); CustomIconPane.this.repaint();// repaint }