private void justifyLineAreas( BlockArea b, double measure, double consumed, int numChildren, BlockAlignment alignment) { double available = measure - consumed; if (alignment == BlockAlignment.JUSTIFY) alignment = BlockAlignment.SPACE_BETWEEN; int numFillers; if (alignment == BlockAlignment.SPACE_AROUND) { numFillers = numChildren + 1; } else if (alignment == BlockAlignment.SPACE_BETWEEN) { numFillers = numChildren - 1; } else numFillers = 0; double fill; if (numFillers > 0) fill = available / numFillers; else fill = 0; if (fill > 0) { List<AreaNode> children = new java.util.ArrayList<AreaNode>(b.getChildren()); for (AreaNode c : children) { AreaNode f = new BlockFillerArea(b.getElement(), 0, fill); if ((c == children.get(0)) && (alignment == BlockAlignment.SPACE_BETWEEN)) continue; else b.insertChild(f, c, null); } if (alignment == BlockAlignment.SPACE_AROUND) { AreaNode f = new BlockFillerArea(b.getElement(), 0, fill); b.insertChild(f, null, null); } } }