本文整理汇总了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;
}