当前位置: 首页>>代码示例>>Java>>正文


Java TextBox.addKeyUpHandler方法代码示例

本文整理汇总了Java中com.google.gwt.user.client.ui.TextBox.addKeyUpHandler方法的典型用法代码示例。如果您正苦于以下问题:Java TextBox.addKeyUpHandler方法的具体用法?Java TextBox.addKeyUpHandler怎么用?Java TextBox.addKeyUpHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gwt.user.client.ui.TextBox的用法示例。


在下文中一共展示了TextBox.addKeyUpHandler方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FileTextBox

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
 * File textBox
 */
public FileTextBox() {
	textBox = new TextBox();
	textBox.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			switch (event.getNativeKeyCode()) {
				case (char) KeyCodes.KEY_ENTER:
					switch (action) {
						case ACTION_RENAME:
							if (textBox.getText().length() > 0) {
								Main.get().mainPanel.desktop.browser.fileBrowser.rename(textBox.getText());
							} else {
								Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							}
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;

				case (char) KeyCodes.KEY_ESCAPE:
					switch (action) {
						case ACTION_RENAME:
							Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;
			}
		}
	});
	textBox.setVisibleLength(20);
	textBox.setStyleName("okm-FileBrowser-TextBox");
	initWidget(textBox);
}
 
开发者ID:openkm,项目名称:document-management-system,代码行数:38,代码来源:FileTextBox.java

示例2: EditorNumberPropertyWidget

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public EditorNumberPropertyWidget(String name, int value) {
  propertyName.setText(name);

  propertyValueBox = new TextBox();
  propertyValueBox.setVisibleLength(3);
  propertyValueBox.setValue(String.valueOf(value));
  propertyValueBox.addKeyUpHandler(this);

  valuePanel.add(propertyValueBox);
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:EditorNumberPropertyWidget.java

示例3: EditorStringPropertyWidget

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public EditorStringPropertyWidget(String name, String value) {
  propertyName.setText(name);

  propertyValueBox = new TextBox();
  propertyValueBox.setVisibleLength(5);
  propertyValueBox.setValue(value);
  propertyValueBox.addKeyUpHandler(this);

  valuePanel.add(propertyValueBox);
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:EditorStringPropertyWidget.java

示例4: LoginWidget

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public LoginWidget(AsyncCallback<Void> logincb, AsyncCallback<Void> logoutcb) {
	this.resize(1, 2);
	this.getCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
	this.addStyleName("easyvote-LoginWidget");
	LoginHandler handler = new LoginHandler();
	
	whoAmIPanel = new HorizontalPanel();
	whoAmIPanel.setVisible(false);
	userIdLabel = new Label();
	userIdLabel.addStyleName("LoginWidget-component");
	whoAmIPanel.add(userIdLabel);
	
	logoutButton = new Button("Logout");
	logoutButton.addStyleName("LoginWidget-logoutButton");
	logoutButton.addClickHandler(new LogoutHandler());
	whoAmIPanel.add(logoutButton);
	setWidget(0, 1, whoAmIPanel);
	
	inputPanel = new FlowPanel();
	loginCallback = logincb;
	logoutCallback = logoutcb;
	
	nameField = new TextBox();
	nameField.setText("VoterID");
	nameField.addStyleName("LoginWidget-component");
	nameField.addKeyUpHandler(handler);
	inputPanel.add(nameField);
	
	passField = new PasswordTextBox();
	passField.setText("Password");
	passField.addKeyUpHandler(handler);
	passField.addStyleName("LoginWidget-component");
	inputPanel.add(passField);
	
	sendButton = new Button("Login");
	sendButton.addClickHandler(handler);
	inputPanel.add(sendButton);
	
	this.setWidget(0, 0, inputPanel);
}
 
开发者ID:nmldiegues,项目名称:easy-vote,代码行数:41,代码来源:LoginWidget.java

示例5: FieldLabeler

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public FieldLabeler(String strLabel) {
	if( strLabel == null ) strLabel = "";
	label.setText( strLabel );
	panel.add( label );
	if( "".equals( strLabel ) ) {
		labelEditor = new TextBox();
		labelEditor.addKeyUpHandler( this );
		labelEditor.addBlurHandler( this );
		panel.add( labelEditor );
		panel.showWidget( 1 );
		editable = true;
	}
	else {
		panel.showWidget( 0 );
	}
}
 
开发者ID:RISCOSS,项目名称:riscoss-corporate,代码行数:17,代码来源:CustomizableForm.java

示例6: UriUtilScreen

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
@Inject
public UriUtilScreen(PlaceManager placeManager) {
    super(placeManager);

    final Label resultLabel = new Label();
    resultLabel.getElement().setId(Debug.shortName(getClass()) + "-resultLabel");

    final TextBox uriCheckerBox = new TextBox();
    uriCheckerBox.getElement().setId(Debug.shortName(getClass()) + "-uriCheckerBox");

    uriCheckerBox.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (URIUtil.isValid(uriCheckerBox.getText())) {
                resultLabel.setText("Not valid.");
            } else {
                resultLabel.setText("Valid. Encoded form is <" + URIUtil.encode(uriCheckerBox.getText()) + ">");
            }
        }
    });

    panel.add(new Label("Type URIs into this box to see if they're valid:"));
    panel.add(uriCheckerBox);
    panel.add(resultLabel);
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:UriUtilScreen.java

示例7: onModuleLoad

import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public void onModuleLoad() {
    Storage storage = Browser.getWindow().getLocalStorage();
    RootPanel.get().add(new HTML("<h3>Open more tabs to send <i>messages</i> and <i>mouse positions<i>!</h3>"));

    // text box which synchronizes its text with the active tab
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(new InlineLabel("message:"));
    TextBox text = new TextBox(); panel.add(text);
    text.addKeyUpHandler(e -> {
        String msg = text.getValue();
        L.log("msg '" + msg + "'");
        storage.setItem("intercomm.msg", msg);
    });
    RootPanel.get().add(panel);

    // floating circle which shows the mouse position of the active tab
    SimplePanel box = new SimplePanel();
    box.getElement().setAttribute("style", ""
            + "position: absolute;"
            + "background-color: #FF9800;"
            + "width: 10px;"
            + "height: 10px;"
            + "border-radius: 10px;");
    RootPanel.get().add(box);
    wnd.addEventListener("mousemove", e -> {
        MouseEvent me = (MouseEvent) e;
        storage.setItem("intercomm.mouse", me.getClientX() + "," + me.getClientY());
    });

    // listeners on the passive tabs
    wnd.addEventListener("storage", e -> {
        L.log(e);
        StorageEvent se = (StorageEvent) e;
        if ("intercomm.msg".equals(se.getKey())) {
            text.setValue(se.getNewValue());
        }
        if ("intercomm.mouse".equals(se.getKey())) {
            String[] xy = se.getNewValue().split(",");
            box.getElement().getStyle().setProperty("left", xy[0] + "px");
            box.getElement().getStyle().setProperty("top", xy[1] + "px");
        }
    });
}
 
开发者ID:ibaca,项目名称:intercomm-gwt,代码行数:44,代码来源:App.java


注:本文中的com.google.gwt.user.client.ui.TextBox.addKeyUpHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。