Browse Source

REPORT-66306 组件包下载面板无遮罩阴影

【问题原因】
swing中两个组件上下层叠时,重绘底层组件,会将其内容会知道上方,遮挡上层组件,
因此也需要手动重新绘制上层组件。

【改动思路】
主动调用下阴影层的重绘方法
bugfix/11.0
Starryi 3 years ago
parent
commit
c1ca4cfdb5
  1. 40
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/OnlineDownloadPackagePane.java

40
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; 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) { protected JPanel createContentPane(JPanel widgetPane) {
JPanel panel = new JPanel() { JPanel panel = new JPanel() {
@Override @Override
@ -114,7 +98,20 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
parentPane.resetWidgetDetailPane(packageId, getSharableWidgetProviders()); 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(downloadProgressPane);
panel.add(widgetPane, BorderLayout.CENTER); panel.add(widgetPane, BorderLayout.CENTER);
return panel; return panel;
@ -125,10 +122,16 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
final com.fr.design.extra.Process<Double> downloadProcess = aDouble -> { final com.fr.design.extra.Process<Double> downloadProcess = aDouble -> {
OnlineDownloadPackagePane.this.process = 0.8 * aDouble; OnlineDownloadPackagePane.this.process = 0.8 * aDouble;
downloadProgressPane.updateProgress(process); downloadProgressPane.updateProgress(process);
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
}; };
final com.fr.design.extra.Process<Double> installProcess = aDouble -> { final com.fr.design.extra.Process<Double> installProcess = aDouble -> {
OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble; OnlineDownloadPackagePane.this.process = 0.8 + 0.2 * aDouble;
downloadProgressPane.updateProgress(process); downloadProgressPane.updateProgress(process);
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
}; };
downloadProcess.process(0.0D); downloadProcess.process(0.0D);
@ -220,6 +223,9 @@ public class OnlineDownloadPackagePane extends OnlineWidgetSelectPane {
File file = new File(filePath); File file = new File(filePath);
installProcess.process(0.0D); installProcess.process(0.0D);
downloadProgressPane.changeState(); downloadProgressPane.changeState();
if (downloadProgressPane != null) {
downloadProgressPane.repaint();
}
InstallUtils.InstallResult result = null; InstallUtils.InstallResult result = null;
try { try {
if (file.exists()) { if (file.exists()) {

Loading…
Cancel
Save