diff options
Diffstat (limited to 'libjava/classpath/javax/swing/text/ParagraphView.java')
-rw-r--r-- | libjava/classpath/javax/swing/text/ParagraphView.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libjava/classpath/javax/swing/text/ParagraphView.java b/libjava/classpath/javax/swing/text/ParagraphView.java index 6c6006a2a0f..6fb121f949e 100644 --- a/libjava/classpath/javax/swing/text/ParagraphView.java +++ b/libjava/classpath/javax/swing/text/ParagraphView.java @@ -59,6 +59,11 @@ public class ParagraphView extends FlowView implements TabExpander { super(el, X_AXIS); } + public float getAlignment(int axis) + { + // FIXME: This is very likely not 100% correct. Work this out. + return 0.0F; + } } /** @@ -86,4 +91,29 @@ public class ParagraphView extends FlowView implements TabExpander { return new Row(getElement()); } + + /** + * Returns the alignment for this paragraph view for the specified axis. + * For the X_AXIS the paragraph view will be aligned at it's left edge + * (0.0F). For the Y_AXIS the paragraph view will be aligned at the + * center of it's first row. + * + * @param axis the axis which is examined + * + * @return the alignment for this paragraph view for the specified axis + */ + public float getAlignment(int axis) + { + if (axis == X_AXIS) + return 0.0F; + else if (getViewCount() > 0) + { + + float prefHeight = getPreferredSpan(Y_AXIS); + float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS); + return (firstRowHeight / 2.F) / prefHeight; + } + else + return 0.0F; + } } |