当前位置: 首页>>代码示例>>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;未经允许,请勿转载。