summaryrefslogtreecommitdiff
path: root/javax/swing/text/ParagraphView.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/text/ParagraphView.java')
-rw-r--r--javax/swing/text/ParagraphView.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/javax/swing/text/ParagraphView.java b/javax/swing/text/ParagraphView.java
index 15bed7818..c4857863d 100644
--- a/javax/swing/text/ParagraphView.java
+++ b/javax/swing/text/ParagraphView.java
@@ -74,6 +74,39 @@ public class ParagraphView extends FlowView implements TabExpander
return align;
}
+ /**
+ * Allows rows to span the whole parent view.
+ */
+ public float getMaximumSpan(int axis)
+ {
+ float max;
+ if (axis == X_AXIS)
+ max = Float.MAX_VALUE;
+ else
+ max = super.getMaximumSpan(axis);
+ return max;
+ }
+
+ /**
+ * Overridden because child views are not necessarily laid out in model
+ * order.
+ */
+ protected int getViewIndexAtPosition(int pos)
+ {
+ int index = -1;
+ if (pos >= getStartOffset() && pos < getEndOffset())
+ {
+ int nviews = getViewCount();
+ for (int i = 0; i < nviews && index == -1; i++)
+ {
+ View child = getView(i);
+ if (pos >= child.getStartOffset() && pos < child.getEndOffset())
+ index = i;
+ }
+ }
+ return index;
+ }
+
protected void loadChildren(ViewFactory vf)
{
// Do nothing here. The children are added while layouting.
@@ -140,7 +173,7 @@ public class ParagraphView extends FlowView implements TabExpander
{
float align;
if (axis == X_AXIS)
- align = super.getAlignment(axis);
+ align = 0.5F;
else if (getViewCount() > 0)
{
float prefHeight = getPreferredSpan(Y_AXIS);
@@ -148,7 +181,7 @@ public class ParagraphView extends FlowView implements TabExpander
align = (firstRowHeight / 2.F) / prefHeight;
}
else
- align = 0.0F;
+ align = 0.5F;
return align;
}