Example usage for com.vaadin.server FontAwesome CUBE

List of usage examples for com.vaadin.server FontAwesome CUBE

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome CUBE.

Prototype

FontAwesome CUBE

To view the source code for com.vaadin.server FontAwesome CUBE.

Click Source Link

Usage

From source file:org.inakirj.imagerulette.screens.DicePlayView.java

License:Open Source License

/**
 * Sets the layout.//from w  w w  .  j  ava 2s .co  m
 */
private void setLayout() {
    mainLayout = new VerticalLayout();
    mainLayout.setWidth(100, Unit.PERCENTAGE);
    FileResource resource = new FileResource(new File(
            VaadinService.getCurrent().getBaseDirectory().getAbsolutePath() + "/WEB-INF/image/nope.png"));
    Image none = new Image("", resource);
    randomImgToBeReplaced = none;
    randomImgToBeReplaced.setWidth(78, Unit.PIXELS);
    randomImgToBeReplaced.setHeight(81, Unit.PIXELS);
    randomImgToBeReplaced.addStyleName("random-image");

    imageLayout = new HorizontalLayout();
    imageLayout.addComponent(randomImgToBeReplaced);
    imageLayout.setWidth(100, Unit.PERCENTAGE);
    imageLayout.setComponentAlignment(randomImgToBeReplaced, Alignment.TOP_CENTER);

    Button rollBtn = new Button();
    rollBtn.addClickListener(e -> onPickABallClick());
    rollBtn.setWidth(25, Unit.PERCENTAGE);
    rollBtn.setHeight(50, Unit.PIXELS);
    rollBtn.setIcon(FontAwesome.CUBE);
    rollBtn.addStyleName("dice-button-roll");

    mainLayout.addComponent(imageLayout);
    mainLayout.addComponent(rollBtn);
    mainLayout.setComponentAlignment(rollBtn, Alignment.BOTTOM_CENTER);

    calculateStats();
    addComponent(mainLayout);
}