All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.rgielen.fxweaver.samples.springboot.controller.MainController Maven / Gradle / Ivy

package net.rgielen.fxweaver.samples.springboot.controller;

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import net.rgielen.fxweaver.core.FxmlView;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Rene Gielen
 */
@Component
@FxmlView // equal to: @FxmlView("MainController.fxml")
public class MainController {

    private final String greeting;
    @FXML
    public Label label;
    @FXML
    public Button button;

    public MainController(@Value("${spring.application.demo.greeting}") String greeting) {
        this.greeting = greeting;
    }

    @FXML
    public void initialize() {
        this.button.setOnAction(
                actionEvent -> this.label.setText(greeting)
        );
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy