From ca6a506c5ab2562fe06b1cd494962d116ffc7d6a Mon Sep 17 00:00:00 2001 From: Starryi Date: Fri, 23 Jul 2021 16:02:04 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55658=20=E3=80=90=E7=A8=B3=E5=AE=9A?= =?UTF-8?q?=E5=85=B1=E5=88=9B=E3=80=91=E7=BB=84=E4=BB=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?-=E5=9B=BE=E8=A1=A8=E5=9D=97=E6=A0=87=E9=A2=98=E5=9B=BE?= =?UTF-8?q?=E6=A1=88-=E5=88=A0=E9=99=A4=E5=90=8E=E5=86=8D=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 点击删除按钮后,删除按钮,遮罩层都是visible,只是父布局不可见了,导致 下次选中图片后,就直接出现了删除按钮和遮罩层 【改动思路】 点击删除按钮时,隐藏遮罩层和删除按钮 --- .../design/gui/xpane/TitleInsetImagePane.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java index 6b5391fb1..48d1028e6 100644 --- a/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java +++ b/designer-form/src/main/java/com/fr/design/gui/xpane/TitleInsetImagePane.java @@ -57,6 +57,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { private UIButton imageChooseButton; private UIButton imageDeleteButton; private ImagePreviewPane imagePreviewPane; + private JPanel imagePreviewOverlayPane; private UIButtonGroup imageLocationPane; private UISpinner imagePaddingPane; @@ -89,24 +90,24 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { deletableImagePreviewPane.setLayout(null); deletableImagePreviewPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 5)); deletableImagePreviewPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE)); - JPanel overlayPane = new JPanel(); - overlayPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2)); - overlayPane.setBackground(IMAGE_PREVIEW_OVERLAY_COLOR); + imagePreviewOverlayPane = new JPanel(); + imagePreviewOverlayPane.setPreferredSize(new Dimension(IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2)); + imagePreviewOverlayPane.setBackground(IMAGE_PREVIEW_OVERLAY_COLOR); imagePreviewPane.setBounds(0, 0, IMAGE_PREVIEW_SIZE, IMAGE_PREVIEW_SIZE); - overlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); + imagePreviewOverlayPane.setBounds(1, 1, IMAGE_PREVIEW_SIZE - 2, IMAGE_PREVIEW_SIZE - 2); imageDeleteButton.setBounds(IMAGE_PREVIEW_SIZE - DELETE_BUTTON_SIZE, 0, DELETE_BUTTON_SIZE, DELETE_BUTTON_SIZE); deletableImagePreviewPane.add(imageDeleteButton, 0); - deletableImagePreviewPane.add(overlayPane, 1); + deletableImagePreviewPane.add(imagePreviewOverlayPane, 1); deletableImagePreviewPane.add(imagePreviewPane, 2); - overlayPane.setVisible(false); + imagePreviewOverlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); deletableImagePreviewPane.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { super.mouseEntered(e); - overlayPane.setVisible(true); + imagePreviewOverlayPane.setVisible(true); imageDeleteButton.setVisible(true); imageDeleteButton.setEnabled(true); } @@ -117,7 +118,7 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { int x = e.getX(); int y = e.getY(); if (x <= 0 || getWidth() <= x || y <= 0 || y >= getHeight()) { - overlayPane.setVisible(false); + imagePreviewOverlayPane.setVisible(false); imageDeleteButton.setVisible(false); imageDeleteButton.setEnabled(false); } @@ -216,6 +217,9 @@ public class TitleInsetImagePane extends JPanel implements UIObserver { imagePreviewPane.setImageWithSuffix(null); imageLocationPane.setSelectedIndex(DEFAULT_INSET_LOCATION_INDEX); imagePaddingPane.setValue(DEFAULT_INSET_PADDING); + imagePreviewOverlayPane.setVisible(false); + imageDeleteButton.setVisible(false); + imageDeleteButton.setEnabled(false); getComponent(1).setVisible(false); fireStateChanged();