/[classpath]/classpath/javax/swing/text/ParagraphView.java
ViewVC logotype

Diff of /classpath/javax/swing/text/ParagraphView.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by rabbit78, Thu Aug 25 19:15:24 2005 UTC revision 1.3 by rabbit78, Wed Oct 5 21:46:41 2005 UTC
# Line 59  public class ParagraphView extends FlowV Line 59  public class ParagraphView extends FlowV
59      {      {
60        super(el, X_AXIS);        super(el, X_AXIS);
61      }      }
62        public float getAlignment(int axis)
63        {
64          // FIXME: This is very likely not 100% correct. Work this out.
65          return 0.0F;
66        }
67    }    }
68    
69    /**    /**
# Line 86  public class ParagraphView extends FlowV Line 91  public class ParagraphView extends FlowV
91    {    {
92      return new Row(getElement());      return new Row(getElement());
93    }    }
94    
95      /**
96       * Returns the alignment for this paragraph view for the specified axis.
97       * For the X_AXIS the paragraph view will be aligned at it's left edge
98       * (0.0F). For the Y_AXIS the paragraph view will be aligned at the
99       * center of it's first row.
100       *
101       * @param axis the axis which is examined
102       *
103       * @return the alignment for this paragraph view for the specified axis
104       */
105      public float getAlignment(int axis)
106      {
107        if (axis == X_AXIS)
108          return 0.0F;
109        else if (getViewCount() > 0)
110          {
111    
112            float prefHeight = getPreferredSpan(Y_AXIS);
113            float firstRowHeight = getView(0).getPreferredSpan(Y_AXIS);
114            return (firstRowHeight / 2.F) / prefHeight;
115          }
116        else
117          return 0.0F;
118      }
119  }  }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26