Prog_3/Trabalhos/ProjetoHospital2/src/App.java
<reponame>WesleyDev184/UFMT<filename>Prog_3/Trabalhos/ProjetoHospital2/src/App.java<gh_stars>0import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class App extends Application {
    private double x, y;

    @Override
    public void start(Stage primaryStage) throws Exception {
        Parent root = FXMLLoader.load(getClass().getResource("./screens/LoginPage/LoginPage.fxml"));
        primaryStage.setScene(new Scene(root));
        // set stage borderless
        primaryStage.initStyle(StageStyle.UNDECORATED);

        // drag it here
        root.setOnMousePressed(event -> {
            x = event.getSceneX();
            y = event.getSceneY();
        });
        root.setOnMouseDragged(event -> {

            primaryStage.setX(event.getScreenX() - x);
            primaryStage.setY(event.getScreenY() - y);

        });
        primaryStage.show();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
