Java Code Examples for com.google.gwt.user.client.ui.TextBox#setFocus()

The following examples show how to use com.google.gwt.user.client.ui.TextBox#setFocus() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: djvu-html5   File: Toolbar.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}
 
Example 2
Source Project: djvu-html5   File: Toolbar.java    License: GNU General Public License v2.0 6 votes vote down vote up
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);
}