com.appperfect.devcommon.script.javaelement
Interface SwingTextComponent

All Superinterfaces:
AwtComponent, AwtContainer, IScript, JavaComponent, SwingComponent
All Known Subinterfaces:
SwingPasswordField, SwingTextArea, SwingTextField

public interface SwingTextComponent
extends SwingComponent

SwingTextComponent is created to represent javax.swing.JTextComponent component

The following code fragment illustrates how to create an SwingTextComponent element.

 var element = engine.createSwingTextComponent(1, 5);
 
where engine is object of IScriptEngine


Method Summary
 int getCaretPos()
 Gets the position of the text insertion caret for this text component.
 java.lang.String getSelectedText()
 Returns the selected text from the text that is presented by this text component.
 int getSelectionEnd()
 Gets the end position of the selected text in this text component.
 int getSelectionStart()
 Gets the start position of the selected text in this text component.
 boolean isEditable()
 Indicates whether or not this text component is editable.
 boolean setCaretPos(int position)
 Sets the position of the text insertion caret for this text component.
 boolean setEditable(boolean editable)
 Sets the flag that determines whether or not this text component is editable.
 boolean setSelection(int columnFrom, int columnTo)
 Sets the selection start and end for this text component to the specified start and ending positions.
 
Methods inherited from interface com.appperfect.devcommon.script.javaelement.AwtContainer
getComponentCount
 
Methods inherited from interface com.appperfect.devcommon.script.javaelement.JavaComponent
activate, addAttribute, captureImage, click, close, dblClick, drag, drop, getName, getText, getToolTipText, maximize, minimize, mouseMove, restore, rightClick, set, setBreakPoint, setIgnored, setImagePath, setName, setThinkTime, setTitle, type
 
Methods inherited from interface com.appperfect.devcommon.script.IScript
getReasonForFailure, isIgnored, isTaskSuccessful, isTaskTimedOut, setReasonForFailure, setTaskSuccessful, setTaskTimedout, setTimeout
 

Method Detail

getCaretPos

int getCaretPos()
Gets the position of the text insertion caret for this text component.

Returns:
the position of the text insertion caret

getSelectedText

java.lang.String getSelectedText()
Returns the selected text from the text that is presented by this text component.

Returns:
the selected text of this text component

getSelectionEnd

int getSelectionEnd()
Gets the end position of the selected text in this text component.

Returns:
the end position of the selected text

getSelectionStart

int getSelectionStart()
Gets the start position of the selected text in this text component.

Returns:
the start position of the selected text

isEditable

boolean isEditable()
Indicates whether or not this text component is editable.

Returns:
true if this text component is editable; false otherwise

setCaretPos

boolean setCaretPos(int position)
Sets the position of the text insertion caret for this text component. The caret position is constrained to be at or before the current selection end. If the caller supplies a value for position that is greater than the end of the component's text, the caret position is set to the end of the component's text. This happens silently and without failure. The caret position also cannot be set to less than zero, the beginning of the component's text.

Parameters:
position - the position of the text insertion caret
Returns:
true if event was executed successfully, returns false if there is any failure during execution

setEditable

boolean setEditable(boolean editable)
Sets the flag that determines whether or not this text component is editable.

If the flag is set to true, this text component becomes user editable. If the flag is set to false, the user cannot change the text of this text component. By default, non-editable text components have a background color of SystemColor.control. This default can be overridden by calling setBackground.

Parameters:
editable - a flag indicating whether this text component is user editable.
Returns:
true if event was executed successfully, returns false if there is any failure during execution

setSelection

boolean setSelection(int columnFrom,
                     int columnTo)
Sets the selection start and end for this text component to the specified start and ending positions. The new start point is constrained to be at or before the current selection end. It also cannot be set to less than zero, the beginning of the component's text. If the caller supplies a value for selectionStart that is out of bounds, the method enforces these constraints silently, and without failure. The new end point is constrained to be at or after the current selection start. It also cannot be set beyond the end of the component's text. If the caller supplies a value for selectionEnd that is out of bounds, the method enforces these constraints silently, and without failure.

Parameters:
columnFrom - the start position of the selected text
columnTo - the start position of the selected text
Returns:
true if event was executed successfully, returns false if there is any failure during execution


Copyright © 2003-2011 AppPerfect Corporation. All Rights Reserved.