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