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

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

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

revision 1.12 by abalkiss, Tue Sep 27 16:46:21 2005 UTC revision 1.13 by abalkiss, Wed Sep 28 14:59:31 2005 UTC
# Line 408  public class Utilities Line 408  public class Utilities
408    public static final int getRowEnd(JTextComponent c, int offs)    public static final int getRowEnd(JTextComponent c, int offs)
409        throws BadLocationException        throws BadLocationException
410    {    {
411      Element root = c.getDocument().getDefaultRootElement();      String text = c.getText();
     Element rowElement = root.getElement(root.getElementIndex(offs));  
     String text = c.getText(rowElement.getStartOffset(),  
                             rowElement.getEndOffset());  
412      if (text == null)      if (text == null)
413        return -1;        return -1;
414    
# Line 420  public class Utilities Line 417  public class Utilities
417      // line as the character at position offs      // line as the character at position offs
418      int high = offs + ((text.length() - 1 - offs) / 2);      int high = offs + ((text.length() - 1 - offs) / 2);
419      int low = offs;      int low = offs;
420      int oldHigh = text.length();      int oldHigh = text.length() + 1;
421      while (true)      while (true)
422        {        {
423          if (c.modelToView(high).y != c.modelToView(offs).y)          if (c.modelToView(high).y != c.modelToView(offs).y)
# Line 454  public class Utilities Line 451  public class Utilities
451    public static final int getRowStart(JTextComponent c, int offs)    public static final int getRowStart(JTextComponent c, int offs)
452        throws BadLocationException        throws BadLocationException
453    {    {
454      Element root = c.getDocument().getDefaultRootElement();      String text = c.getText();
     Element rowElement = root.getElement(root.getElementIndex(offs));  
     String text = c.getText(rowElement.getStartOffset(),  
                             rowElement.getEndOffset());  
455      if (text == null)      if (text == null)
456        return -1;        return -1;
457    

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

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