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 899c04cb1..b4b382af5 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 @@ -7,6 +7,7 @@ import com.fr.base.ScreenResolution; import com.fr.base.Style; import com.fr.general.FRFont; import com.fr.general.IOUtils; +import com.fr.stable.Constants; import com.fr.stable.unit.PT; import javax.swing.JPanel; @@ -153,16 +154,16 @@ public class CellStylePreviewPane extends JPanel { float adjustRight = 0; float adjustBottom = 0; if (column == 0) { - adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F; + adjustLeft = GraphHelper.getLineStyleSize(style.getBorderLeft()) / 2.0F + computeOffset4DoubleStyleBorder(style); } if (row == 0) { - adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F; + adjustTop = GraphHelper.getLineStyleSize(style.getBorderTop()) / 2.0F + computeOffset4DoubleStyleBorder(style); } if (column == columnSpan - 1) { - adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F; + adjustRight = -GraphHelper.getLineStyleSize(style.getBorderRight()) / 2.0F - computeOffset4DoubleStyleBorder(style); } if (row == rowSpan - 1) { - adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F; + adjustBottom = -GraphHelper.getLineStyleSize(style.getBorderBottom()) / 2.0F - computeOffset4DoubleStyleBorder(style); } g2d.translate(adjustLeft, adjustTop); @@ -170,6 +171,17 @@ public class CellStylePreviewPane extends JPanel { g2d.translate(-adjustLeft, -adjustTop); } + private float computeOffset4DoubleStyleBorder(Style style) { + float offset = 0F; + if (style.getBorderLeft() == Constants.LINE_DOUBLE) { + offset += GraphHelper.getLineStyleSize(Constants.LINE_THIN) / 2.0F; + } else if (style.getBorderLeft() == Constants.LINE_DOUBLE_DOT) { + offset += GraphHelper.getLineStyleSize(Constants.LINE_DOT) / 2.0F; + } + + return offset; + } + @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize();