本文整理匯總了Java中com.vaadin.ui.Button.setIcon方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.setIcon方法的具體用法?Java Button.setIcon怎麽用?Java Button.setIcon使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.vaadin.ui.Button
的用法示例。
在下文中一共展示了Button.setIcon方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SimplyAsAnImageOrIcon
import com.vaadin.ui.Button; //導入方法依賴的package包/類
public SimplyAsAnImageOrIcon() {
setCaption("Image and icon");
addComponent(new MLabel("Following Image component (rendered as IMG element) contains SVG image. Note, that by using SVG in this way, it is treated as a static image. For eample the js changing the color on click is not executed. See the file example to see how to render an interactive SVG.").withFullWidth());
Image image = new Image(null, new ClassResource("/pull.svg"));
image.setWidth("300px");
addComponent(image);
addComponent(new MLabel("Following Button has SVG logo as an icon.").withFullWidth());
Button button = new Button();
button.setIcon(new ClassResource("/vaadin-logo.svg"));
button.addStyleNames(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_HUGE);
addComponent(button);
}
示例2: enter
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
if (!isLoggedIn()) {
getUI().getNavigator().navigateTo(LoginView.VIEW_NAME);
return;
}
addComponent(new HeadingLabel("會員名簿", VaadinIcons.BULLETS));
printAllMembers();
Button homeButton = new Button("會員メニュー", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.USER);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例3: enter
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("ログアウト確認", VaadinIcons.INFO_CIRCLE));
addComponent(new Label("ログアウトします。"));
HorizontalLayout buttonArea = new HorizontalLayout();
buttonArea.setSpacing(true);
addComponent(buttonArea);
setComponentAlignment(buttonArea, Alignment.MIDDLE_CENTER);
Button cancelButton = new Button("キャンセル", click -> getUI().getNavigator().navigateTo(MenuView.VIEW_NAME));
buttonArea.addComponent(cancelButton);
Button logoutButton = new Button("ログアウト", click -> {
membershipService.logout();
getUI().getNavigator().navigateTo(FrontView.VIEW_NAME);
});
logoutButton.setIcon(VaadinIcons.SIGN_OUT);
logoutButton.setStyleName(ValoTheme.BUTTON_PRIMARY);
buttonArea.addComponent(logoutButton);
}
示例4: enter
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("參加登録完了", VaadinIcons.CHECK));
addComponent(new Label("參加登録が完了し、確認メールを送信しました。"));
Label addressLabel = new Label("しばらく待ってもメールが來ない場合は、お手數ですが " + appReply + " までご連絡ください。");
addressLabel.setCaption("お願い");
addressLabel.setIcon(VaadinIcons.LIGHTBULB);
addComponent(addressLabel);
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.HOME);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例5: enter
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
addComponent(new HeadingLabel("パスワードリセット要求送信完了", VaadinIcons.INFO_CIRCLE));
addComponent(new Label("入力された E-mail アドレスへパスワードリセットの案內メールを送信しました。"));
Label addressLabel = new Label("しばらく待ってもメールが來ない場合は、お手數ですが " + appReply + " までご連絡ください。");
addressLabel.setCaption("お願い");
addressLabel.setIcon(VaadinIcons.LIGHTBULB);
addComponent(addressLabel);
Button homeButton = new Button("ホーム", click -> getUI().getNavigator().navigateTo(FrontView.VIEW_NAME));
homeButton.setIcon(VaadinIcons.HOME);
addComponent(homeButton);
setComponentAlignment(homeButton, Alignment.MIDDLE_CENTER);
}
示例6: createMenuButton
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Button createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {
final Button button = new Button(caption, (e) -> {
contentLayout.removeAllComponents();
contentLayout.addComponent(content.get());
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return button;
}
示例7: buildToolbarButton
import com.vaadin.ui.Button; //導入方法依賴的package包/類
/**
* @param toolbar
* HorizontalLayout which contains all the action Buttons
* @param toolbarButton
* Which Tool bar button to create (Provided using ENUM constant)
* @param listner
* Click listener called when this button is clicked
* @return
*/
public static Button buildToolbarButton(HorizontalLayout toolbar, ToolbarButtons toolbarButton,
ClickListener listner) {
Button button = new Button(toolbarButton.getText());
button.addStyleName(StyleConstants.BUTTON_TOOLBAR);
button.setDescription(toolbarButton.getTooltip());
button.setStyleName(ValoTheme.BUTTON_LINK);
if (StringUtils.isNotEmpty(toolbarButton.getImageLocation())) {
button.setIcon(new ThemeResource(toolbarButton.getImageLocation()), toolbarButton.toString());
}
button.setEnabled(false);
button.setId(toolbarButton.getId());
button.addClickListener(listner);
toolbar.addComponent(button);
return button;
}
示例8: createHeader
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title) {
HorizontalLayout header = ViewUtil.createSubHeader(title, getSubViewHelpGuid());
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
populateTable();
}
});
header.addComponent(refresh);
return header;
}
示例9: createMenuButtonForNotification
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Button createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return button;
}
示例10: createHeader
import com.vaadin.ui.Button; //導入方法依賴的package包/類
@SuppressWarnings("serial")
private HorizontalLayout createHeader(String title, final boolean isChildTable) {
HorizontalLayout header = null;
if (isChildTable) {
header = ViewUtil.createSubHeader(title, getChildHelpGuid());
} else {
header = ViewUtil.createSubHeader(title, getParentHelpGuid());
}
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
if (isChildTable) {
populateChildTable(getParentItem());
} else {
populateParentTable();
}
}
});
header.addComponent(refresh);
return header;
}
示例11: createHeaderForSslList
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private HorizontalLayout createHeaderForSslList() {
HorizontalLayout header = ViewUtil.createSubHeader("List of available certificates", null);
Button refresh = new Button();
refresh.setStyleName(Reindeer.BUTTON_LINK);
refresh.setDescription("Refresh");
refresh.setIcon(new ThemeResource("img/Refresh.png"));
refresh.addClickListener((Button.ClickListener) event -> buildSslConfigurationTable());
header.addComponent(refresh);
return header;
}
示例12: createSubHeader
import com.vaadin.ui.Button; //導入方法依賴的package包/類
/**
* @param caption
* Caption Text Representing Header
* @param guid
* Help GUID for caller view
* @return
* Horizontal Layout containing Caption text and Help button
*/
public static HorizontalLayout createSubHeader(String caption, String guid) {
HorizontalLayout subHeader = new HorizontalLayout();
subHeader.setWidth("100%");
subHeader.setHeight("35px");
subHeader.setSpacing(true);
subHeader.addStyleName("toolbar");
final Label title = new Label(caption);
title.setSizeUndefined();
subHeader.addComponent(title);
subHeader.setComponentAlignment(title, Alignment.MIDDLE_LEFT);
subHeader.setExpandRatio(title, 1);
// create help button if we have some GUID else do not add this button
if (guid != null) {
Button helpButton = new Button();
helpButton.setImmediate(true);
helpButton.setStyleName(Reindeer.BUTTON_LINK);
helpButton.setDescription("Help");
helpButton.setIcon(new ThemeResource("img/Help.png"));
subHeader.addComponent(helpButton);
helpButton.addClickListener(new HelpButtonListener(guid));
}
return subHeader;
}
示例13: addTab
import com.vaadin.ui.Button; //導入方法依賴的package包/類
public Button addTab(MaterialIcons icon, String text) {
Button button = new Button(text);
button.setPrimaryStyleName(lightTheme ? Styles.Tabs.IconText.LIGHT : Styles.Tabs.IconText.DARK);
button.setIcon(icon);
button.addClickListener(event -> selectTab(button));
buttons.add(button);
addComponent(button);
return button;
}
示例14: createMenuButtonForNotification
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Pair<String, Button> createMenuButtonForNotification(VaadinIcons icon, String caption, String message) {
final Button button
= new Button(caption,
(e) -> {
UI ui = UI.getCurrent();
ConfirmDialog.show(
ui,
message, // ToDo extract in Executor
(ConfirmDialog.Listener) dialog -> {
if (dialog.isConfirmed()) {
getSubject().logout(); //removes all identifying information and invalidates their session too.
VaadinSession vaadinSession = ui.getSession();
vaadinSession.setAttribute(SESSION_ATTRIBUTE_USER, null);
vaadinSession.close();
ui.getPage().setLocation("/");
}
else {
// User did not confirm
// CANCEL STUFF
}
});
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(MainView.class, caption));
return new Pair<>(mapToShiroRole(caption), button);
}
示例15: createMenuButton
import com.vaadin.ui.Button; //導入方法依賴的package包/類
private Pair<String, Button> createMenuButton(VaadinIcons icon, String caption, Supplier<CustomComponent> content) {
final Button button = new Button(caption, (e) -> {
contentLayout.removeAllComponents();
contentLayout.addComponent(content.get());
});
button.setIcon(icon);
button.addStyleName(ValoTheme.BUTTON_HUGE);
button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
button.addStyleName(ValoTheme.MENU_ITEM);
button.setWidth("100%");
button.setId(buttonID().apply(this.getClass(), caption));
return new Pair<>(mapToShiroRole(caption), button);
}