Example usage for com.vaadin.ui ColorPicker setDefaultCaptionEnabled

List of usage examples for com.vaadin.ui ColorPicker setDefaultCaptionEnabled

Introduction

In this page you can find the example usage for com.vaadin.ui ColorPicker setDefaultCaptionEnabled.

Prototype

public void setDefaultCaptionEnabled(boolean enabled) 

Source Link

Document

Set true if the component should show a default caption (css-code for the currently selected color, e.g.

Usage

From source file:com.cavisson.gui.dashboard.components.controls.ColorPickers.java

License:Apache License

public ColorPickers() {
    setMargin(true);//from ww  w  .  j  ava2  s. c  o  m

    Label h1 = new Label("Color Pickers");
    h1.addStyleName("h1");
    addComponent(h1);

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    addComponent(row);

    TestIcon testIcon = new TestIcon(40);

    ColorPicker cp = new ColorPicker();
    cp.setDefaultCaptionEnabled(true);
    cp.setIcon(testIcon.get());
    cp.setColor(new Color(138, 73, 115));
    row.addComponent(cp);

    cp = new ColorPicker();
    cp.setPopupStyle(PopupStyle.POPUP_SIMPLE);
    cp.setTextfieldVisibility(true);
    row.addComponent(cp);
}