本文整理汇总了Java中com.google.gwt.user.client.ui.TextBoxBase.getText方法的典型用法代码示例。如果您正苦于以下问题:Java TextBoxBase.getText方法的具体用法?Java TextBoxBase.getText怎么用?Java TextBoxBase.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextBoxBase
的用法示例。
在下文中一共展示了TextBoxBase.getText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertStringIntoTextBoxWrapper
import com.google.gwt.user.client.ui.TextBoxBase; //导入方法依赖的package包/类
/**
* This method should be basically called from the void addSmileStringToMessage( final String ); method of SmileSelectionDialogUI.SmileySelectionTarget
* @param stringToInsert the string to insert
* @param wrapper the wrapper object containing the text box base object into which we insert the smiley code
*/
public static void insertStringIntoTextBoxWrapper( final String stringToInsert, final TextBaseTranslitAndProgressBar wrapper ) {
final TextBoxBase textObj = wrapper.getWrappedTextBoxBaseObj();
//If the text box base is not null, is enabled and is not read-only
if( textObj != null && textObj.isEnabled() && ! textObj.isReadOnly() ) {
if( BrowserDetect.getBrowserDetect().isMSExplorer() ) {
//In IE8 if we work with the TextBox then the cursor position
//is set wrongly, unless the text object has focus in it.
textObj.setFocus(true);
}
final int currentCursorPos = textObj.getCursorPos();
final String currentMessageText = textObj.getText();
textObj.setText( currentMessageText.substring(0, currentCursorPos) + stringToInsert +
currentMessageText.substring(currentCursorPos, currentMessageText.length() ) );
textObj.setCursorPos( currentCursorPos + stringToInsert.length() );
//Force the progress bar update
wrapper.setFocusAndUpdate();
}
}