From c1ca4cfdb514e474dff2ec5c34da922d8e58d59e Mon Sep 17 00:00:00 2001 From: Starryi Date: Mon, 14 Feb 2022 14:39:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-66306=20=E7=BB=84=E4=BB=B6=E5=8C=85?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=9D=A2=E6=9D=BF=E6=97=A0=E9=81=AE=E7=BD=A9?= =?UTF-8?q?=E9=98=B4=E5=BD=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【问题原因】 swing中两个组件上下层叠时,重绘底层组件,会将其内容会知道上方,遮挡上层组件, 因此也需要手动重新绘制上层组件。 【改动思路】 主动调用下阴影层的重绘方法 --- .../ui/online/OnlineDownloadPackagePane.java | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java index 59a09c466..987cfface 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java @@ -72,22 +72,6 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { return false; } - protected JPanel createWidgetPane() { - return new JPanel() { - @Override - public void paint(Graphics g) { - super.paint(g); - Graphics2D g2d = (Graphics2D) g; - Composite oldComposite = g2d.getComposite(); - AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f); - g2d.setComposite(composite); - g2d.setColor(Color.DARK_GRAY); - g2d.fillRect(0, 0, getWidth(), getHeight()); - g2d.setComposite(oldComposite); - } - }; - } - protected JPanel createContentPane(JPanel widgetPane) { JPanel panel = new JPanel() { @Override @@ -114,7 +98,20 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { parentPane.resetWidgetDetailPane(packageId, getSharableWidgetProviders()); } } - }); + }) { + @Override + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + Composite oldComposite = g2d.getComposite(); + AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.65f); + g2d.setComposite(composite); + g2d.setColor(Color.DARK_GRAY); + g2d.fillRect(0, 0, getWidth(), getHeight()); + g2d.setComposite(oldComposite); + + super.paint(g); + } + }; panel.add(downloadProgressPane); panel.add(widgetPane, BorderLayout.CENTER); return panel; @@ -125,10 +122,16 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { final com.fr.design.extra.Process downloadProcess = aDouble -> { OnlineDownloadPackagePane.this.process = 0.8 * aDouble; downloadProgressPane.updateProgress(process); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } }; final com.fr.design.extra.Process installProcess = aDouble -> { OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble; downloadProgressPane.updateProgress(process); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } }; downloadProcess.process(0.0D); @@ -220,6 +223,9 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane { File file = new File(filePath); installProcess.process(0.0D); downloadProgressPane.changeState(); + if (downloadProgressPane != null) { + downloadProgressPane.repaint(); + } InstallUtils.InstallResult result = null; try { if (file.exists()) {