diff --git a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java index 015fecee9d..d278d130f8 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellRectangleStylePreviewPane.java @@ -46,7 +46,7 @@ public class CellRectangleStylePreviewPane extends JPanel { for (int r = 0; r < ROW_COUNT; r++) { for (int c = 0; c < COLUMN_COUNT; c++) { - CellStylePreviewPane pane = new CellStylePreviewPane(); + CellStylePreviewPane pane = new CellStylePreviewPane(false); TemplateCellElement cellElement = DefaultThemedTemplateCellElementCase.createInstance(c, r); int flags = CellBorderSourceFlag.INVALID_BORDER_SOURCE; if (supportInnerBorder) { diff --git a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java index b7e43c38cd..66a873d4d1 100644 --- a/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java +++ b/designer-base/src/main/java/com/fr/design/cell/CellStylePreviewPane.java @@ -33,7 +33,10 @@ public class CellStylePreviewPane extends JPanel { private String paintText = "Report"; private Style style = Style.DEFAULT_STYLE; - public CellStylePreviewPane() { + private final boolean autoClearCanvas; + + public CellStylePreviewPane(boolean autoClearCanvas) { + this.autoClearCanvas = autoClearCanvas; setPreferredSize(new Dimension(0, 0)); } @@ -55,6 +58,9 @@ public class CellStylePreviewPane extends JPanel { @Override public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; + if (autoClearCanvas) { + g2d.clearRect(0, 0, getWidth(), getHeight()); + } g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); diff --git a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java index 250861dbef..a5295ad7ec 100644 --- a/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java +++ b/designer-realize/src/main/java/com/fr/design/report/ReportStylePane.java @@ -53,6 +53,7 @@ import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; +import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -78,7 +79,7 @@ public class ReportStylePane extends BasicPane { setLayout(FRGUIPaneFactory.createBorderLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); - previewArea = new CellStylePreviewPane(); + previewArea = new CellStylePreviewPane(true); followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); followingThemeButtonGroup.setAutoFireStateChanged(false); customStylePane = new CustomFloatStyleSettingPane();