LoginSignup
0
2

More than 5 years have passed since last update.

[自分用] Spring BootでVaadinなサイトを作ったやり方まとめ

Posted at

目的

Vaadinを使ってJavaだけでいい感じのUIを作りたかった

はじめに

https://start.spring.io
でいい感じのプロジェクトを生成してくれるので、DependenciesにVaadinを入れてGenerate Projectするだけでok

一応Spring BootでVaadinがどういう感じなのかのチュートリアル的なサンプルは ここにある

お役立ちサイト

https://demo.vaadin.com/valo-theme/

どんな感じのUIのパーツがあるのかを一覧で見れる

http://demo.vaadin.com/sampler/

各パーツの実装サンプルがあり、各パーツのパラメータをその場で変更してどういう効果があるのかを確認できる

https://vaadin.com/directory

アドオンでよりリッチにすることができる

Hello World

VaadinUI.java
@SpringUI
@Theme(ValoTheme.THEME_NAME)
public class VaadinUI extends UI {
    @Override
    protected void init(VaadinRequest request) {
        VerticalLayout verticalLayout = new VerticalLayout();
        verticalLayout.addComponent(makeButton());
        setContent(verticalLayout);
    }

    private Button makeButton() {
        Button button = new Button("Click Me", FontAwesome.APPLE);
        button.addClickListener((Button.ClickListener) event -> {
            Notification.show("Hello World!!");
        });
        return button;
    }
}
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2