diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java index bca48fac7..0fc194492 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/FormThemePreviewPane.java @@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.TemplateThemePreviewPane; import com.fr.design.mainframe.theme.preview.ecpreview.ECComponentPreviewPane; -import com.fr.design.utils.ComponentUtils; import com.fr.general.Background; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.PiePlot4VanChart; @@ -24,10 +23,10 @@ import com.fr.plugin.chart.type.RadiusType; import com.fr.plugin.chart.vanchart.VanChart; import com.fr.stable.Constants; import com.fr.stable.StringUtils; - -import javax.swing.JComponent; import javax.swing.JPanel; -import java.util.ArrayList; +import java.awt.AlphaComposite; +import java.awt.Composite; +import java.awt.Graphics2D; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -44,6 +43,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { private Background background; private ChartComponentPreviewPane columnChartPreviewPane; private ChartComponentPreviewPane pieChartPreviewPane; + private float alpha = 1.0F; public FormThemePreviewPane() { setLayout(FRGUIPaneFactory.createBorderLayout()); @@ -72,9 +72,9 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { } }; pieChartPanel.setLayout(new BorderLayout()); - pieChartPreviewPane = createChartPreviewPane(initPieChart(), 300, 368); + pieChartPreviewPane = createChartPreviewPane(initPieChart(), 217, 368); pieChartPanel.add(pieChartPreviewPane, BorderLayout.CENTER); - chartContent.add(columnChartPanel, BorderLayout.WEST); + chartContent.add(columnChartPanel, BorderLayout.CENTER); chartContent.add(pieChartPanel, BorderLayout.EAST); return chartContent; } @@ -89,6 +89,7 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { @Override public void refresh(FormTheme theme) { background = theme.getBodyStyle().getStyle().getBackground(); + alpha = theme.getBodyStyle().getStyle().getAlpha(); elementCasePane.refresh(theme); columnChartPreviewPane.refresh(theme); pieChartPreviewPane.refresh(theme); @@ -96,18 +97,19 @@ public class FormThemePreviewPane extends TemplateThemePreviewPane { } - public void paint(Graphics g) { - // 禁止双缓冲 - ArrayList dbcomponents = new ArrayList(); + @Override + public void paintComponent(Graphics g) { + paintBackground((Graphics2D) g); + } + private void paintBackground(Graphics2D g2d) { if (background == null) { background = ColorBackground.getInstance(Color.WHITE); } - background.paint(g, new Rectangle2D.Double(0, 0, 517, 532)); - paintChildren(g); - // 恢复双缓冲 - ComponentUtils.resetBuffer(dbcomponents); - + Composite oldComposite = g2d.getComposite(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); + g2d.setComposite(oldComposite); } //柱形图 diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java index 71aad36ec..f4e23853d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ReportThemePreviewPane.java @@ -12,7 +12,6 @@ import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.theme.TemplateThemePreviewPane; import com.fr.design.mainframe.theme.preview.ecpreview.ECReportPreviewPane; -import com.fr.design.utils.ComponentUtils; import com.fr.general.Background; import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.attr.axis.VanChartAxis; @@ -21,8 +20,7 @@ import com.fr.plugin.chart.base.VanChartTools; import com.fr.plugin.chart.column.VanChartColumnPlot; import com.fr.plugin.chart.vanchart.VanChart; -import javax.swing.JComponent; -import java.util.ArrayList; +import java.awt.Graphics2D; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; @@ -57,19 +55,16 @@ public class ReportThemePreviewPane extends TemplateThemePreviewPane dbcomponents = new ArrayList(); - + private void paintBackground(Graphics2D g2d) { if (background == null) { background = ColorBackground.getInstance(Color.WHITE); } - background.paint(g, new Rectangle2D.Double(0, 0, 517, 532)); - paintChildren(g); - // 恢复双缓冲 - ComponentUtils.resetBuffer(dbcomponents); - + background.paint(g2d, new Rectangle2D.Double(0, 0, 517, 532)); }