public class MyUI extends UI { @Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); // Apply Lumo Styles theme UI.getCurrent().setTheme(Lumo.class); } } Button button = new Button("Click me"); Label label = new Label("Hello, Vaadin!"); layout.addComponents(button, label); button.addStyleName("custom-button"); label.addStyleName("custom-label"); css .custom-button { background-color: blue; color: white; } .custom-label { font-weight: bold; } MyUI.java public class MyUI extends UI { @Override protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); // Apply Lumo Styles theme UI.getCurrent().setTheme(Lumo.class); Button button = new Button("Click me"); Label label = new Label("Hello, Vaadin!"); layout.addComponents(button, label); button.addStyleName("custom-button"); label.addStyleName("custom-label"); } } styles.css css .custom-button { background-color: blue; color: white; } .custom-label { font-weight: bold; } <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-lumo-styles</artifactId> <version>1.5.1</version> </dependency>


上一篇:
下一篇:
切换中文