當前位置: 首頁>>代碼示例>>Java>>正文


Java TextField.setIcon方法代碼示例

本文整理匯總了Java中com.vaadin.ui.TextField.setIcon方法的典型用法代碼示例。如果您正苦於以下問題:Java TextField.setIcon方法的具體用法?Java TextField.setIcon怎麽用?Java TextField.setIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.TextField的用法示例。


在下文中一共展示了TextField.setIcon方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: buildFields

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private Component buildFields() {
    HorizontalLayout fields = new HorizontalLayout();
    fields.setSpacing(true);
    fields.addStyleName("fields");

    final TextField username = new TextField("Username");
    username.setIcon(FontAwesome.USER);
    username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final PasswordField password = new PasswordField("Password");
    password.setIcon(FontAwesome.LOCK);
    password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

    final Button signin = new Button("Sign In");
    signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
    signin.setClickShortcut(KeyCode.ENTER);
    signin.focus();

    fields.addComponents(username, password, signin);
    fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

    signin.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            DashboardEventBus.post(new UserLoginRequestedEvent(username
                    .getValue(), password.getValue()));
        }
    });
    return fields;
}
 
開發者ID:mcollovati,項目名稱:vaadin-vertx-samples,代碼行數:31,代碼來源:LoginView.java

示例2: addTextFieldValues

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private static TextField addTextFieldValues(final TextField textField, final Resource icon,
        final Validator validator) {
    textField.setIcon(icon);
    textField.setRequired(true);
    if (validator != null) {
        textField.addValidator(validator);
    }
    return textField;
}
 
開發者ID:eclipse,項目名稱:hawkbit-examples,代碼行數:10,代碼來源:GenerateDialog.java

示例3: createSearchBar

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private MHorizontalLayout createSearchBar() {
    Label header = new Label("Bookery");
    header.addStyleName(ValoTheme.LABEL_BOLD);
    header.setSizeUndefined();
    header.addStyleName(ValoTheme.LABEL_H3);
    
    searchText = new TextField();
    searchText.setIcon(FontAwesome.SEARCH);
    searchText.addStyleName(ValoTheme.TEXTFIELD_LARGE);
    searchText.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    searchText.setWidth(100, Unit.PERCENTAGE);
    searchText.setInputPrompt("hier einfach suchen..");
    Button searchButton = new Button("such!", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            Navigator navigator = ((App)UI.getCurrent()).getNavigator();
            if (navigator.getState().contains("search")) {
                navigator.navigateTo(navigator.getState());
            }
            else {
                navigator.navigateTo(SearchView.id);
            }
            
        }
    });
    searchButton.addStyleName(ValoTheme.BUTTON_LARGE);
    searchText.addShortcutListener(new Button.ClickShortcut(searchButton, ShortcutAction.KeyCode.ENTER));

    MHorizontalLayout layout = new MHorizontalLayout(header,searchText,searchButton);
    layout.setWidth(100, Unit.PERCENTAGE);
    layout.setExpandRatio(searchText, 1.0f);
    return layout;
}
 
開發者ID:felixhusse,項目名稱:bookery,代碼行數:34,代碼來源:AppHeader.java

示例4: buildUserField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void buildUserField() {
    username = new TextField(i18n.getMessage("label.login.username"));
    username.setIcon(FontAwesome.USER);
    username.addStyleName(
            ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
    username.setId("login-username");
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:8,代碼來源:AbstractHawkbitLoginUI.java

示例5: buildTenantField

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private void buildTenantField() {
    if (multiTenancyIndicator.isMultiTenancySupported()) {
        tenant = new TextField(i18n.getMessage("label.login.tenant"));
        tenant.setIcon(FontAwesome.DATABASE);
        tenant.addStyleName(
                ValoTheme.TEXTFIELD_INLINE_ICON + " " + ValoTheme.TEXTFIELD_SMALL + " " + LOGIN_TEXTFIELD);
        tenant.addStyleName("uppercase");
        tenant.setId("login-tenant");
    }
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:11,代碼來源:AbstractHawkbitLoginUI.java

示例6: buildFilter

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private Component buildFilter() {
    final TextField filter = new TextField();
    filter.addTextChangeListener(new TextChangeListener() {
        @Override
        public void textChange(final TextChangeEvent event) {
            Filterable data = (Filterable) table.getContainerDataSource();
            data.removeAllContainerFilters();
            data.addContainerFilter(new Filter() {
                @Override
                public boolean passesFilter(final Object itemId,
                        final Item item) {

                    if (event.getText() == null
                            || event.getText().equals("")) {
                        return true;
                    }

                    return filterByProperty("country", item,
                            event.getText())
                            || filterByProperty("city", item,
                                    event.getText())
                            || filterByProperty("title", item,
                                    event.getText());

                }

                @Override
                public boolean appliesToProperty(final Object propertyId) {
                    if (propertyId.equals("country")
                            || propertyId.equals("city")
                            || propertyId.equals("title")) {
                        return true;
                    }
                    return false;
                }
            });
        }
    });

    filter.setInputPrompt("Filter");
    filter.setIcon(FontAwesome.SEARCH);
    filter.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
    filter.addShortcutListener(new ShortcutListener("Clear",
            KeyCode.ESCAPE, null) {
        @Override
        public void handleAction(final Object sender, final Object target) {
            filter.setValue("");
            ((Filterable) table.getContainerDataSource())
                    .removeAllContainerFilters();
        }
    });
    return filter;
}
 
開發者ID:mcollovati,項目名稱:vaadin-vertx-samples,代碼行數:54,代碼來源:TransactionsView.java

示例7: buildFields

import com.vaadin.ui.TextField; //導入方法依賴的package包/類
private Component buildFields() {
	HorizontalLayout fields = new HorizontalLayout();
	fields.setSpacing(true);
	fields.addStyleName("fields");

	final TextField username = new TextField("Username");
	// Pre-populate for convenience
	username.setValue("admin");
	username.setIcon(FontAwesome.USER);
	username.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);

	final PasswordField password = new PasswordField("Password");
	password.setIcon(FontAwesome.LOCK);
	password.addStyleName(ValoTheme.TEXTFIELD_INLINE_ICON);
	password.setValue("[email protected]");

	final Button signin = new Button("Sign In");
	signin.addStyleName(ValoTheme.BUTTON_PRIMARY);
	signin.setClickShortcut(KeyCode.ENTER);
	signin.focus();

	fields.addComponents(username, password, signin);
	fields.setComponentAlignment(signin, Alignment.BOTTOM_LEFT);

	signin.addClickListener(new ClickListener() {
		/**
		 * 
		 */
		private static final long serialVersionUID = -8816421044737741430L;

		@Override
		public void buttonClick(final ClickEvent event) {
			try {
				VaadinServletService.getCurrentServletRequest().login(
						username.getValue(), password.getValue());
			} catch (ServletException e) {
				Notification.show("Authentication Failed");
				return;
			}
			Page.getCurrent().setLocation("secured");
		}
	});
	return fields;
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:45,代碼來源:LoginUI.java


注:本文中的com.vaadin.ui.TextField.setIcon方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。