本文整理匯總了Java中com.google.gwt.user.client.ui.TextBox.setFocus方法的典型用法代碼示例。如果您正苦於以下問題:Java TextBox.setFocus方法的具體用法?Java TextBox.setFocus怎麽用?Java TextBox.setFocus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.TextBox
的用法示例。
在下文中一共展示了TextBox.setFocus方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: zoomTypedIn
import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
protected void zoomTypedIn() {
if (pageLayout == null)
return;
TextBox zoomTextBox = zoomPanel.textBox;
String digits = zoomTextBox.getText().replaceAll("[^0-9]", "");
if (digits.isEmpty() || digits.length() > 6) {
zoomTextBox.setText(pageLayout.getZoom() + "%");
zoomTextBox.selectAll();
return;
}
int zoom = Math.min(Integer.valueOf(digits), DjvuContext.getMaxZoom());
zoom = Math.max(zoom, zoomOptions.get(zoomOptions.size() - 1));
zoomPanel.selection.setSelectedIndex(-1);
pageLayout.setZoom(zoom);
zoomTextBox.setText(zoom + "%");
zoomTextBox.setFocus(false);
}
示例2: pageTypedIn
import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
protected void pageTypedIn() {
if (pageLayout == null)
return;
TextBox pageTextBox = pagePanel.textBox;
String digits = pageTextBox.getText().replaceAll("[^0-9]", "");
if (digits.isEmpty() || digits.length() > 6) {
pageTextBox.setText(pagePanel.selection.getSelectedItemText());
pageTextBox.selectAll();
return;
}
int page = Math.min(Integer.valueOf(digits), pagesCount) - 1;
page = Math.max(page, 0);
pagePanel.selection.setSelectedIndex(page);
pageLayout.setPage(page);
pageTextBox.setFocus(false);
}
示例3: copy
import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
private void copy() {
TextBox t = new TextBox();
try {
t.setText(getText());
content.add(t);
t.setFocus(true);
t.selectAll();
boolean ok = execCommand("copy");
Tooltip.setLabel(copier, ok ? CopyableLabelText.I.copied() : CopyableLabelText.I.failed());
if (!ok) {
// Disable JavaScript clipboard and try flash movie in another instance.
UserAgent.disableJavaScriptClipboard();
}
} finally {
t.removeFromParent();
}
}
示例4: showInputDialog
import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
public static BaseDialog showInputDialog(Widget parent,
String msg,
String intialValue,
int preferWidth,
final ClickHandler okHandler,
final ClickHandler cancelHandler) {
final TextBox text = new TextBox();
text.setVisibleLength(preferWidth);
if (!StringUtils.isEmpty(intialValue)) {
text.setText(intialValue);
}
final BaseDialog dialog= new BaseDialog(parent, ButtonType.OK_CANCEL,"Input Dialog",true,null) {
protected void inputComplete() {
if (okHandler!=null) {
okHandler.onClick(new ClickEvent() {
@Override
public Object getSource() {
return text.getText();
}
});
}
}
protected void inputCanceled() {
if (cancelHandler!=null) cancelHandler.onClick(null);
}
};
text.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent ev) {
final char keyCode= ev.getCharCode();
DeferredCommand.addCommand(new Command() {
public void execute() {
if (keyCode== KeyCodes.KEY_ENTER) {
dialog.getButton(BaseDialog.ButtonID.OK).click();
}
}
});
}
});
VerticalPanel vp = new VerticalPanel();
vp.setSpacing(5);
vp.add(new HTML("<h3>" + msg + "</h3>"));
vp.add(text);
dialog.setWidget(vp);
dialog.setVisible(true);
text.setFocus(true);
return dialog;
}
示例5: selectAllAndFocus
import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
private static void selectAllAndFocus(TextBox textBox) {
textBox.selectAll();
textBox.setFocus(true);
}