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


Java Button.setIcon方法代碼示例

本文整理匯總了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);
}
 
開發者ID:mstahv,項目名稱:svgexamples,代碼行數:15,代碼來源:SimplyAsAnImageOrIcon.java

示例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);
}
 
開發者ID:JavaTrainingCourse,項目名稱:obog-manager,代碼行數:16,代碼來源:MemberListView.java

示例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);
}
 
開發者ID:JavaTrainingCourse,項目名稱:obog-manager,代碼行數:22,代碼來源:LogoutConfirmView.java

示例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);
}
 
開發者ID:JavaTrainingCourse,項目名稱:obog-manager,代碼行數:14,代碼來源:ThanksView.java

示例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);
}
 
開發者ID:JavaTrainingCourse,項目名稱:obog-manager,代碼行數:14,代碼來源:TokenSentView.java

示例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;
  }
 
開發者ID:Java-Publications,項目名稱:javamagazin-009-microkernel,代碼行數:18,代碼來源:MainView.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:26,代碼來源:ViewUtil.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:CRUDBaseSubView.java

示例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;

}
 
開發者ID:Java-Publications,項目名稱:javamagazin-009-microkernel,代碼行數:35,代碼來源:MainView.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:28,代碼來源:CRUDBaseView.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:12,代碼來源:SslConfigurationLayout.java

示例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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:36,代碼來源:ViewUtil.java

示例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;
}
 
開發者ID:vaadin,項目名稱:material-theme-fw8,代碼行數:10,代碼來源:Tabs.java

示例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);

}
 
開發者ID:Java-Publications,項目名稱:vaadin-016-helloworld-14,代碼行數:38,代碼來源:MenuComponent.java

示例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);
}
 
開發者ID:Java-Publications,項目名稱:vaadin-016-helloworld-14,代碼行數:16,代碼來源:MenuComponent.java


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