import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.notification.Notification; import com.vaadin.flow.component.orderedlayout.VerticalLayout; import com.vaadin.flow.router.Route; import com.vaadin.flow.server.PWA; import com.vaadin.flow.server.VaadinRequest; import com.vaadin.flow.server.VaadinServlet; @Route("") @PWA(name = "Vaadin Application", shortName = "Vaadin App") public class MyApplication extends VaadinServlet { @Override protected void service(VaadinRequest request, VaadinResponse response) throws ServletException, IOException { VerticalLayout layout = new VerticalLayout(); Button button = new Button("Click me"); button.addClickListener(event -> { Notification.show("Button clicked!"); }); layout.addComponent(button); setContent(layout); } }


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