double (Graphics2D g, Rectangle2D clip) { LineMetrics lineMetrics = getHeaderFooterLineMetrics(g); double w = clip.getWidth(); double x = clip.getX(); double y = clip.getY(); double h = 0; boolean wasDrawn = false; String headerText1 = myPrintSettings.FOOTER_HEADER_TEXT1; if (!StringUtil.isEmpty(headerText1) && myPrintSettings.FOOTER_HEADER_PLACEMENT1 == PrintSettings.Placement.Header) { h = drawHeaderOrFooterLine(g, x, y, w, headerText1, myPrintSettings.FOOTER_HEADER_ALIGNMENT1); wasDrawn = true; y += h; } String headerText2 = myPrintSettings.FOOTER_HEADER_TEXT2; if (!StringUtil.isEmpty(headerText1) && myPrintSettings.FOOTER_HEADER_PLACEMENT2 == PrintSettings.Placement.Header) { if (myPrintSettings.FOOTER_HEADER_ALIGNMENT1 == PrintSettings.Alignment.Left && myPrintSettings.FOOTER_HEADER_ALIGNMENT2 == PrintSettings.Alignment.Right && wasDrawn) { y -= h; } h = drawHeaderOrFooterLine(g, x, y, w, headerText2, myPrintSettings.FOOTER_HEADER_ALIGNMENT2); y += h; wasDrawn = true; } return wasDrawn ? y - clip.getY() + lineMetrics.getHeight() / 3 : 0; }