jdk/src/share/classes/java/awt/TextComponent.java
changeset 20172 f48935a247ec
parent 19807 9f7860fad128
child 20469 47a792bd7dbf
equal deleted inserted replaced
20171:099045062d79 20172:f48935a247ec
   970          * Determines the bounding box of the character at the given
   970          * Determines the bounding box of the character at the given
   971          * index into the string.  The bounds are returned in local
   971          * index into the string.  The bounds are returned in local
   972          * coordinates.  If the index is invalid a null rectangle
   972          * coordinates.  If the index is invalid a null rectangle
   973          * is returned.
   973          * is returned.
   974          *
   974          *
   975          * @param i the index into the String >= 0
   975          * @param i the index into the String >= 0
   976          * @return the screen coordinates of the character's bounding box
   976          * @return the screen coordinates of the character's bounding box
   977          */
   977          */
   978         public Rectangle getCharacterBounds(int i) {
   978         public Rectangle getCharacterBounds(int i) {
   979             return TextComponent.this.getCharacterBounds(i);
   979             return TextComponent.this.getCharacterBounds(i);
   980         }
   980         }
   981 
   981 
   982         /**
   982         /**
   983          * Returns the number of characters (valid indicies)
   983          * Returns the number of characters (valid indicies)
   984          *
   984          *
   985          * @return the number of characters >= 0
   985          * @return the number of characters >= 0
   986          */
   986          */
   987         public int getCharCount() {
   987         public int getCharCount() {
   988             return TextComponent.this.getText().length();
   988             return TextComponent.this.getText().length();
   989         }
   989         }
   990 
   990 
  1016          * If there is no selection, but there is
  1016          * If there is no selection, but there is
  1017          * a caret, the start and end offsets will be the same.
  1017          * a caret, the start and end offsets will be the same.
  1018          * Return 0 if the text is empty, or the caret position
  1018          * Return 0 if the text is empty, or the caret position
  1019          * if no selection.
  1019          * if no selection.
  1020          *
  1020          *
  1021          * @return the index into the text of the start of the selection >= 0
  1021          * @return the index into the text of the start of the selection >= 0
  1022          */
  1022          */
  1023         public int getSelectionStart() {
  1023         public int getSelectionStart() {
  1024             return TextComponent.this.getSelectionStart();
  1024             return TextComponent.this.getSelectionStart();
  1025         }
  1025         }
  1026 
  1026 
  1029          * If there is no selection, but there is
  1029          * If there is no selection, but there is
  1030          * a caret, the start and end offsets will be the same.
  1030          * a caret, the start and end offsets will be the same.
  1031          * Return 0 if the text is empty, or the caret position
  1031          * Return 0 if the text is empty, or the caret position
  1032          * if no selection.
  1032          * if no selection.
  1033          *
  1033          *
  1034          * @return the index into teh text of the end of the selection >= 0
  1034          * @return the index into teh text of the end of the selection >= 0
  1035          */
  1035          */
  1036         public int getSelectionEnd() {
  1036         public int getSelectionEnd() {
  1037             return TextComponent.this.getSelectionEnd();
  1037             return TextComponent.this.getSelectionEnd();
  1038         }
  1038         }
  1039 
  1039 
  1054         /**
  1054         /**
  1055          * Returns the String at a given index.
  1055          * Returns the String at a given index.
  1056          *
  1056          *
  1057          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1057          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1058          * or AccessibleText.SENTENCE to retrieve
  1058          * or AccessibleText.SENTENCE to retrieve
  1059          * @param index an index within the text >= 0
  1059          * @param index an index within the text >= 0
  1060          * @return the letter, word, or sentence,
  1060          * @return the letter, word, or sentence,
  1061          *   null for an invalid index or part
  1061          *   null for an invalid index or part
  1062          */
  1062          */
  1063         public String getAtIndex(int part, int index) {
  1063         public String getAtIndex(int part, int index) {
  1064             if (index < 0 || index >= TextComponent.this.getText().length()) {
  1064             if (index < 0 || index >= TextComponent.this.getText().length()) {
  1120         /**
  1120         /**
  1121          * Returns the String after a given index.
  1121          * Returns the String after a given index.
  1122          *
  1122          *
  1123          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1123          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1124          * or AccessibleText.SENTENCE to retrieve
  1124          * or AccessibleText.SENTENCE to retrieve
  1125          * @param index an index within the text >= 0
  1125          * @param index an index within the text &gt;= 0
  1126          * @return the letter, word, or sentence, null for an invalid
  1126          * @return the letter, word, or sentence, null for an invalid
  1127          *  index or part
  1127          *  index or part
  1128          */
  1128          */
  1129         public String getAfterIndex(int part, int index) {
  1129         public String getAfterIndex(int part, int index) {
  1130             if (index < 0 || index >= TextComponent.this.getText().length()) {
  1130             if (index < 0 || index >= TextComponent.this.getText().length()) {
  1173         /**
  1173         /**
  1174          * Returns the String before a given index.
  1174          * Returns the String before a given index.
  1175          *
  1175          *
  1176          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1176          * @param part the AccessibleText.CHARACTER, AccessibleText.WORD,
  1177          *   or AccessibleText.SENTENCE to retrieve
  1177          *   or AccessibleText.SENTENCE to retrieve
  1178          * @param index an index within the text >= 0
  1178          * @param index an index within the text &gt;= 0
  1179          * @return the letter, word, or sentence, null for an invalid index
  1179          * @return the letter, word, or sentence, null for an invalid index
  1180          *  or part
  1180          *  or part
  1181          */
  1181          */
  1182         public String getBeforeIndex(int part, int index) {
  1182         public String getBeforeIndex(int part, int index) {
  1183             if (index < 0 || index > TextComponent.this.getText().length()-1) {
  1183             if (index < 0 || index > TextComponent.this.getText().length()-1) {