1. /*
  2. * @(#)AccessibleEditableText.java 1.4 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.accessibility;
  8. import java.util.*;
  9. import java.awt.*;
  10. import javax.swing.text.*;
  11. /**
  12. * <P>The AccessibleEditableText interface should be implemented by all
  13. * classes that present editable textual information on the display.
  14. * Along with the AccessibleText interface, this interface provides
  15. * the standard mechanism for an assistive technology to access
  16. * that text via its content, attributes, and spatial location.
  17. * Applications can determine if an object supports the AccessibleEditableText
  18. * interface by first obtaining its AccessibleContext (see {@link Accessible})
  19. * and then calling the {@link AccessibleContext#getAccessibleEditableText}
  20. * method of AccessibleContext. If the return value is not null, the object
  21. * supports this interface.
  22. *
  23. * @see Accessible
  24. * @see Accessible#getAccessibleContext
  25. * @see AccessibleContext
  26. * @see AccessibleContext#getAccessibleText
  27. * @see AccessibleContext#getAccessibleEditableText
  28. *
  29. * @version 1.4 @(#)AccessibleEditableText.java 1.4
  30. * @author Lynn Monsanto
  31. */
  32. public interface AccessibleEditableText extends AccessibleText {
  33. /**
  34. * Sets the text contents to the specified string.
  35. *
  36. * @param s the string to set the text contents
  37. */
  38. public void setTextContents(String s);
  39. /**
  40. * Inserts the specified string at the given index/
  41. *
  42. * @param index the index in the text where the string will
  43. * be inserted
  44. * @param s the string to insert in the text
  45. */
  46. public void insertTextAtIndex(int index, String s);
  47. /**
  48. * Returns the text string between two indices.
  49. *
  50. * @param startIndex the starting index in the text
  51. * @param endIndex the ending index in the text
  52. * @return the text string between the indices
  53. */
  54. public String getTextRange(int startIndex, int endIndex);
  55. /**
  56. * Deletes the text between two indices
  57. *
  58. * @param startIndex the starting index in the text
  59. * @param endIndex the ending index in the text
  60. */
  61. public void delete(int startIndex, int endIndex);
  62. /**
  63. * Cuts the text between two indices into the system clipboard.
  64. *
  65. * @param startIndex the starting index in the text
  66. * @param endIndex the ending index in the text
  67. */
  68. public void cut(int startIndex, int endIndex);
  69. /**
  70. * Pastes the text from the system clipboard into the text
  71. * starting at the specified index.
  72. *
  73. * @param startIndex the starting index in the text
  74. */
  75. public void paste(int startIndex);
  76. /**
  77. * Replaces the text between two indices with the specified
  78. * string.
  79. *
  80. * @param startIndex the starting index in the text
  81. * @param endIndex the ending index in the text
  82. * @param s the string to replace the text between two indices
  83. */
  84. public void replaceText(int startIndex, int endIndex, String s);
  85. /**
  86. * Selects the text between two indices.
  87. *
  88. * @param startIndex the starting index in the text
  89. * @param endIndex the ending index in the text
  90. */
  91. public void selectText(int startIndex, int endIndex);
  92. /**
  93. * Sets attributes for the text between two indices.
  94. *
  95. * @param startIndex the starting index in the text
  96. * @param endIndex the ending index in the text
  97. * @param as the attribute set
  98. * @see AttributeSet
  99. */
  100. public void setAttributes(int startIndex, int endIndex, AttributeSet as);
  101. }