本文整理匯總了Java中com.google.gwt.user.client.ui.TextArea.setFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java TextArea.setFocus方法的具體用法?Java TextArea.setFocus怎麽用?Java TextArea.setFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.TextArea
的用法示例。
在下文中一共展示了TextArea.setFocus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showTextArea
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
private void showTextArea() {
final TextArea textArea=new TextArea();
textArea.setStyleName("mf-writeACommentTextArea");
textArea.setTitle(i18n.hitCtrlEnterToSubmitComment());
textArea.setFocus(true);
textArea.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
if(event.getNativeKeyCode()==KeyCodes.KEY_ENTER && event.isControlKeyDown()) {
if(!"".equals(textArea.getText())) {
ctx.getStatusLine().showProgress(i18n.savingYourComment());
ctx.getService().saveQuestionComment(questionId,textArea.getText(),new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
ctx.getRia().handleServiceError(caught);
}
public void onSuccess(String result) {
ctx.getStatusLine().hideStatus();
textArea.setVisible(false);
CommentBean commentBean=new CommentBean(
result,
ctx.getState().getCurrentUser(),
questionId,
textArea.getText(),
new Date());
// this is a new comment, therefore it is always added at the end - replacing existing one ;-)
final int threadRow = questionCommentsPanel.getRowCount()-1;
questionCommentsPanel.setWidget(threadRow, 0, new ViewCommentPanel(threadRow, questionCommentsPanel, commentBean, ctx));
questionCommentsPanel.addNewComment();
}
});
}
}
}
});
add(textArea);
}
示例2: createWordCloud
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
private void createWordCloud()
{
TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
String text = textArea.getText().trim();
if (!text.isEmpty())
{
createWordCloud(text);
}
else
{
textArea.setFocus(true);
}
}
示例3: onModuleLoad
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
public void onModuleLoad() {
// create the widgets
final Button analyseButton = new Button(messages.sendButton());
final Button configureButton = new Button(messages.configureButton());
final TextArea mainTextArea = new TextArea();
mainTextArea.setCharacterWidth(80);
mainTextArea.setVisibleLines(15);
final Label errorLabel = new Label();
final CellTable<SnomedConcept> resultsTable = new CellTable<>();
// add them to the root panel
RootPanel.get("mainTextArea").add(mainTextArea);
RootPanel.get("analyseButton").add(analyseButton);
RootPanel.get("configureButton").add(configureButton);
RootPanel.get("status").add(errorLabel);
RootPanel.get("snomedCodes").add(resultsTable);
// set the focus to the text area
mainTextArea.setFocus(true);
// initialise the SNOMED code results table
final List<SnomedConcept> conceptList = configSnomedTable(resultsTable);
// add the handlers
final List<SemanticType> types = new ArrayList<>();
final Map<String, String> typeCodeToDescription = new HashMap<>();
analyseButton.addClickHandler(
new AnalyseHandler(mainTextArea, errorLabel, conceptList, types, typeCodeToDescription));
configureButton.addClickHandler(new ConfigureHandler(types, typeCodeToDescription));
}
示例4: insertBetweenSelectionText
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
public static void insertBetweenSelectionText(TextSelection selection,String header,String footer){
String newText=header+selection.getSelection()+footer;
selection.replace(newText);
TextArea target=selection.getTargetTextArea();
target.setCursorPos(selection.getStart()+(header+selection.getSelection()).length());
target.setFocus(true);
}
示例5: createClipboardTextArea
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
private TextArea createClipboardTextArea() {
final TextArea pasteArea = new TextArea();
pasteArea.setPixelSize(0, 0);
Style style = pasteArea.getElement().getStyle();
style.setPosition(Style.Position.FIXED);
RootPanel.get().add(pasteArea);
pasteArea.setFocus(true);
return pasteArea;
}