jdk/src/java.desktop/share/classes/javax/swing/text/View.java
changeset 30462 507bcb03c954
parent 27063 964ad56e8d1c
child 42216 621af0ebf6c4
equal deleted inserted replaced
30461:57e36ed1a9ab 30462:507bcb03c954
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   379     }
   379     }
   380 
   380 
   381     /**
   381     /**
   382      * Removes one of the children at the given position.
   382      * Removes one of the children at the given position.
   383      * This is a convenience call to <code>replace</code>.
   383      * This is a convenience call to <code>replace</code>.
       
   384      * @param i the position
   384      * @since 1.3
   385      * @since 1.3
   385      */
   386      */
   386     public void remove(int i) {
   387     public void remove(int i) {
   387         replace(i, 1, null);
   388         replace(i, 1, null);
   388     }
   389     }
   442      * the model.  By default a view has no children so this is implemented
   443      * the model.  By default a view has no children so this is implemented
   443      * to return -1 to indicate there is no valid child index for any
   444      * to return -1 to indicate there is no valid child index for any
   444      * position.
   445      * position.
   445      *
   446      *
   446      * @param pos the position &gt;= 0
   447      * @param pos the position &gt;= 0
       
   448      * @param b the bias
   447      * @return  index of the view representing the given position, or
   449      * @return  index of the view representing the given position, or
   448      *   -1 if no view represents that position
   450      *   -1 if no view represents that position
   449      * @since 1.3
   451      * @since 1.3
   450      */
   452      */
   451     public int getViewIndex(int pos, Position.Bias b) {
   453     public int getViewIndex(int pos, Position.Bias b) {
   478      * within the range of &gt;=0.  If the value is -1, a position
   480      * within the range of &gt;=0.  If the value is -1, a position
   479      * will be calculated automatically.  If the value &lt; -1,
   481      * will be calculated automatically.  If the value &lt; -1,
   480      * the {@code BadLocationException} will be thrown.
   482      * the {@code BadLocationException} will be thrown.
   481      *
   483      *
   482      * @param pos the position to convert
   484      * @param pos the position to convert
       
   485      * @param b the bias
   483      * @param a the allocated region in which to render
   486      * @param a the allocated region in which to render
   484      * @param direction the direction from the current position that can
   487      * @param direction the direction from the current position that can
   485      *  be thought of as the arrow keys typically found on a keyboard.
   488      *  be thought of as the arrow keys typically found on a keyboard.
   486      *  This will be one of the following values:
   489      *  This will be one of the following values:
   487      * <ul>
   490      * <ul>
   488      * <li>SwingConstants.WEST
   491      * <li>SwingConstants.WEST
   489      * <li>SwingConstants.EAST
   492      * <li>SwingConstants.EAST
   490      * <li>SwingConstants.NORTH
   493      * <li>SwingConstants.NORTH
   491      * <li>SwingConstants.SOUTH
   494      * <li>SwingConstants.SOUTH
   492      * </ul>
   495      * </ul>
       
   496      * @param biasRet the returned bias
   493      * @return the location within the model that best represents the next
   497      * @return the location within the model that best represents the next
   494      *  location visual position
   498      *  location visual position
   495      * @exception BadLocationException the given position is not a valid
   499      * @exception BadLocationException the given position is not a valid
   496      *                                 position within the document
   500      *                                 position within the document
   497      * @exception IllegalArgumentException if <code>direction</code>
   501      * @exception IllegalArgumentException if <code>direction</code>
   660      * character in the model.
   664      * character in the model.
   661      *
   665      *
   662      * @param x the X coordinate &gt;= 0
   666      * @param x the X coordinate &gt;= 0
   663      * @param y the Y coordinate &gt;= 0
   667      * @param y the Y coordinate &gt;= 0
   664      * @param a the allocated region in which to render
   668      * @param a the allocated region in which to render
       
   669      * @param biasReturn the returned bias
   665      * @return the location within the model that best represents the
   670      * @return the location within the model that best represents the
   666      *  given point in the view &gt;= 0.  The <code>biasReturn</code>
   671      *  given point in the view &gt;= 0.  The <code>biasReturn</code>
   667      *  argument will be
   672      *  argument will be
   668      * filled in to indicate that the point given is closer to the next
   673      * filled in to indicate that the point given is closer to the next
   669      * character in the model or the previous character in the model.
   674      * character in the model or the previous character in the model.
   862      * subclasses.
   867      * subclasses.
   863      * Each view should document what attributes it recognizes
   868      * Each view should document what attributes it recognizes
   864      * for the purpose of rendering or layout, and should always
   869      * for the purpose of rendering or layout, and should always
   865      * access them through the <code>AttributeSet</code> returned
   870      * access them through the <code>AttributeSet</code> returned
   866      * by this method.
   871      * by this method.
       
   872      * @return the attributes to use when rendering
   867      */
   873      */
   868     public AttributeSet getAttributes() {
   874     public AttributeSet getAttributes() {
   869         return elem.getAttributes();
   875         return elem.getAttributes();
   870     }
   876     }
   871 
   877 
  1024 
  1030 
  1025     /**
  1031     /**
  1026      * Returns the tooltip text at the specified location. The default
  1032      * Returns the tooltip text at the specified location. The default
  1027      * implementation returns the value from the child View identified by
  1033      * implementation returns the value from the child View identified by
  1028      * the passed in location.
  1034      * the passed in location.
       
  1035      * @param x the x coordinate
       
  1036      * @param y the y coordinate
       
  1037      * @param allocation current allocation of the View.
       
  1038      * @return the tooltip text at the specified location
  1029      *
  1039      *
  1030      * @since 1.4
  1040      * @since 1.4
  1031      * @see JTextComponent#getToolTipText
  1041      * @see JTextComponent#getToolTipText
  1032      */
  1042      */
  1033     public String getToolTipText(float x, float y, Shape allocation) {
  1043     public String getToolTipText(float x, float y, Shape allocation) {