Java 类javafx.stage.StageBuilder 实例源码

项目:sakuli    文件:UiTestApplication.java   
@Override
public void run() {
    Rectangle2D bounds = Screen.getPrimary().getVisualBounds();
    //create Login scene
    Scene loginScene = gotoLogin();
    width = bounds.getWidth();
    height = bounds.getHeight() * HEIGHT_PERCENTAGE;
    Stage stage = StageBuilder.create()
            .x(0).y(0)
            .width(width)
            .height(height)
            .title("Sakuli Login Sample")
            .scene(loginScene)
            .onCloseRequest(new EventHandler<WindowEvent>() {
                @Override
                public void handle(WindowEvent event) {
                    LOGGER.info("PLATFORM exit!");
                }
            }).build();
    LOGGER.info("set width '{}' and height '{}'", width, height);
    start(stage);
}
项目:fxpoc    文件:SampleUICommand.java   
/**
 * {@inheritDoc}
 */
@Override
protected void execute(final Wave wave) {

    LOGGER.info("Display a pop up from JAT");

    final Stage s = StageBuilder.create()
            .title("Sample Ui Command Test")
            .style(StageStyle.DECORATED)
            .scene(SceneBuilder.create()
                    .root(LabelBuilder.create().text("Run into JAT").build())
                    .build())

            .build();

    s.show();
    // Sample for popup => Attach owner !!!
    // getLocalFacade().getGlobalFacade().getApplication().getStage()
}
项目:simplejavayoutubeuploader    文件:QueueUploadCellRenderer.java   
@Override
public void handle(final ActionEvent event) {
    if (item.getStatus().isRunning()) {
        return;
    }
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
        final ConfirmDialogController controller = result.getController();
        controller.setTitle(resources.getString("dialog.removeupload.title"));
        controller.setMessage(resources.getString("dialog.removeupload.message"));

        final Parent parent = result.getRoot();
        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.showAndWait();
        stage.requestFocus();
        if (controller.ask()) {
            uploadService.delete(upload);
        }
    } catch (final IOException e) {
        logger.error("Couldn't load ConfirmDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:QueueUploadCellRenderer.java   
@Override
public void handle(final ActionEvent arg0) {
    if (!item.getStatus().isRunning()) {
        return;
    }

    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
        final ConfirmDialogController controller = result.getController();
        controller.setTitle(resources.getString("dialog.abortupload.title"));
        controller.setMessage(resources.getString("dialog.abortupload.message"));

        final Parent parent = result.getRoot();
        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.showAndWait();
        stage.requestFocus();
        if (controller.ask()) {
            uploadService.abort(item);
        }
    } catch (final IOException e) {
        logger.error("Couldn't load ConfirmDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:DialogHelper.java   
public void showPlaylistAddDialog() {
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
                "/de/chaosfisch/uploader/view/PlaylistAddDialog.fxml"), resources);
        final Parent parent = result.getRoot();

        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.requestFocus();
        stage.showAndWait();
    } catch (final IOException e) {
        logger.error("Couldn't load PlaylistAddDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:DialogHelper.java   
public void showErrorDialog(final String title, final String message) {
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
                "/de/chaosfisch/uploader/view/ErrorDialog.fxml"), resources);
        final ErrorDialogController controller = result.getController();
        controller.setTitle(title);
        controller.setMessage(message);

        final Parent parent = result.getRoot();
        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.showAndWait();
        stage.requestFocus();
    } catch (final IOException e) {
        logger.error("Couldn't load ConfirmDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:DialogHelper.java   
public void showInputDialog(final String title, final String input, final Callback callback, final boolean blocking) {
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
                "/de/chaosfisch/uploader/view/InputDialog.fxml"), resources);
        final Parent parent = result.getRoot();
        final InputDialogController controller = result.getController();
        controller.setTitle(resources.containsKey(title) ? resources.getString(title) : title);
        controller.setInput(resources.containsKey(input) ? resources.getString(input) : input);
        controller.setCallback(callback);

        final Scene scene = SceneBuilder.create().fill(Color.TRANSPARENT).root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        if (blocking) {
            stage.showAndWait();
        } else {
            stage.show();
        }
        stage.requestFocus();
    } catch (final IOException e) {
        logger.error("Couldn't load InputDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:DialogHelper.java   
public void showAccountPermissionsDialog(final Account account) {
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
                "/de/chaosfisch/uploader/view/AccountAddDialog.fxml"), resources);
        final Parent parent = result.getRoot();
        ((AccountAddDialogController) result.getController()).initAuth(account);

        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.DECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.setResizable(true);
        stage.requestFocus();
        stage.showAndWait();
    } catch (final Exception e) {
        logger.error("Couldn't load AccountAddDialog", e);
    }
}
项目:simplejavayoutubeuploader    文件:QueueCommandController.java   
@FXML
void startQueue(final ActionEvent event) {
    try {
        final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
        final ConfirmDialogController controller = result.getController();
        controller.setTitle(resources.getString("dialog.youtubetos.title"));
        controller.setMessage(resources.getString("dialog.youtubetos.message"));

        final Parent parent = result.getRoot();
        final Scene scene = SceneBuilder.create().root(parent).build();
        final Stage stage = StageBuilder.create().scene(scene).build();
        stage.initStyle(StageStyle.UNDECORATED);
        stage.initModality(Modality.APPLICATION_MODAL);
        stage.showAndWait();
        stage.requestFocus();
        if (controller.ask()) {
            uploadService.startUploading();
        }
    } catch (final IOException e) {
        logger.error("Couldn't load ConfirmDialog", e);
    }
}
项目:fx-player    文件:FxPlayerApplication.java   
@Override
public void start(Stage stage) throws Exception {
    String title = ResourceBundle.getBundle(getClass().getName(), Locale.getDefault())
            .getString("title");
    String version = ResourceBundle.getBundle(getClass().getName(), Locale.getDefault())
            .getString("version");
    if ((version != null) && !version.isEmpty()) {
        title = title + " - " + version;
    }
    StageBuilder.create().title(title)
            .icons(new Image(getClass().getResourceAsStream("icon.png"))).applyTo(stage);

    stage.setOnCloseRequest(new EventHandler<WindowEvent>() {

        @Override
        public void handle(WindowEvent event) {
            Platform.exit();
        }
    });

    FxUtils.scene(stage, PlayList.class);
    stage.show();
}
项目:btc1k    文件:App.java   
@Override
public void start (Stage primaryStage) throws Exception
{
    instance = this;

    restClient = new RestClient (SERVER_URI);
    vault = new Vault (fetchKeys ());

    FXMLLoader loader = new FXMLLoader (App.class.getResource ("main.fxml"));
    Parent root = (Parent) loader.load ();

    Scene scene = SceneBuilder.create ()
            .root (root)
            .stylesheets ("com/bitsofproof/btc1k/fx/main.css")
            .build ();

    StageBuilder.create ()
            .title ("BTC-1K")
            .scene (scene)
            .minWidth (600)
            .minHeight (600)
            .applyTo (primaryStage);

    primaryStage.show ();

}