Example usage for javafx.stage Stage initStyle

List of usage examples for javafx.stage Stage initStyle

Introduction

In this page you can find the example usage for javafx.stage Stage initStyle.

Prototype

public final void initStyle(StageStyle style) 

Source Link

Document

Specifies the style for this stage.

Usage

From source file:spdxedit.PackageEditor.java

/**
 * Opens the modal package editor for the provided package.
 *
 * @param pkg               The package to edit.
 * @param relatablePackages Packages to which the edited package may optionally have defined relationships
 * @param parentWindow      The parent window.
 *//*from w w w  .ja v a  2s  .  com*/
public static void editPackage(final SpdxPackage pkg, final List<SpdxPackage> relatablePackages,
        SpdxDocumentContainer documentContainer, Window parentWindow) {

    final PackageEditor packageEditor = new PackageEditor(pkg, relatablePackages, documentContainer);
    final Stage dialogStage = new Stage();
    dialogStage.setTitle("Edit SPDX Package: " + pkg.getName());
    dialogStage.initStyle(StageStyle.DECORATED);
    dialogStage.initModality(Modality.APPLICATION_MODAL);
    dialogStage.setY(parentWindow.getX() + parentWindow.getWidth() / 2);
    dialogStage.setY(parentWindow.getY() + parentWindow.getHeight() / 2);
    dialogStage.setResizable(false);
    try {
        FXMLLoader loader = new FXMLLoader(NewPackageDialog.class.getResource("/PackageEditor.fxml"));
        loader.setController(packageEditor);
        Pane pane = loader.load();
        Scene scene = new Scene(pane);
        dialogStage.setScene(scene);
        dialogStage.getIcons().clear();
        dialogStage.getIcons().add(UiUtils.ICON_IMAGE_VIEW.getImage());
        //Populate the file list on appearance
        dialogStage.setOnShown(event -> {
            try {
                final SpdxFile dummyfile = new SpdxFile(pkg.getName(), null, null, null, null, null, null, null,
                        null, null, null, null, null);
                TreeItem<SpdxFile> root = new TreeItem<>(dummyfile);
                packageEditor.filesTable.setRoot(root);
                //Assume a package without is external
                //TODO: replace with external packages or whatever alternate mechanism in 2.1
                packageEditor.btnAddFile.setDisable(pkg.getFiles().length == 0);
                root.getChildren()
                        .setAll(Stream.of(pkg.getFiles())
                                .sorted(Comparator.comparing(file -> StringUtils.lowerCase(file.getName()))) //Sort by file name
                                .map(TreeItem<SpdxFile>::new).collect(Collectors.toList()));
            } catch (InvalidSPDXAnalysisException e) {
                logger.error("Unable to get files for package " + pkg.getName(), e);
            }

            packageEditor.tabFiles.setExpanded(true);

        });

        //Won't assign this event through FXML - don't want to propagate the stage beyond this point.
        packageEditor.btnOk.setOnMouseClicked(event -> dialogStage.close());
        dialogStage.showAndWait();

    } catch (IOException ioe) {
        throw new RuntimeException("Unable to load dialog", ioe);
    }
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.DECORATED);
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);/*from  w w w  . j  a v  a 2s.  c om*/
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.UNDECORATED);
    Text text = new Text("Transparent!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);/* w  w w.j  a va 2  s  .co m*/
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.UTILITY);
    Text text = new Text("!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);// w w  w.  java  2  s .c om
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.initStyle(StageStyle.UNDECORATED);
    Text text = new Text("Transparent!");
    text.setFont(new Font(40));
    VBox box = new VBox();
    box.getChildren().add(text);/*from  w w w.j  a v a  2s.c o m*/
    final Scene scene = new Scene(box, 300, 250);
    scene.setFill(null);
    stage.setScene(scene);
    stage.show();
    scene.setCursor(Cursor.WAIT);
}

From source file:net.sf.anathema.framework.presenter.action.about.AnathemaAboutAction.java

private Stage initializeDialogStage(Scene scene) {
    final Stage aboutStage = new Stage();
    aboutStage.initStyle(StageStyle.UNDECORATED);
    aboutStage.initOwner(stage);/*  w  w w  . ja  v  a  2  s. co  m*/
    aboutStage.setResizable(false);
    aboutStage.setTitle(resources.getString("Help.AboutDialog.Title"));
    aboutStage.setScene(scene);
    initCloseOnEscape(aboutStage);
    return aboutStage;
}

From source file:User.java

@Override
public void start(Stage primaryStage) {
    this.primaryStage = primaryStage;
    user = new User();

    primaryStage.initStyle(StageStyle.TRANSPARENT);

    root = new Group();
    Scene scene = new Scene(root, 320, 112, Color.rgb(0, 0, 0, 0));

    primaryStage.setScene(scene);/*from www .  ja v  a2  s  .co  m*/

    Rectangle background = this.drawRectangleBackground();
    HBox row1 = this.drawRow1();
    HBox row2 = this.drawRow2();

    VBox formLayout = new VBox(4); // spacing
    formLayout.setLayoutX(12);
    formLayout.setLayoutY(12);

    formLayout.getChildren().addAll(row1, row2);

    root.getChildren().addAll(background, formLayout);

    primaryStage.show();
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage3(Stage stage, Label lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {//from   w w  w.j a v a 2 s.c  om
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage(Stage stage, Label lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {/* w  w  w  .j a v a2s.c  o  m*/
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        stage.close();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.toyota.carservice.config.config2.java

public Object newStage2(Stage stage, Button lb, String load, String judul, boolean resize, StageStyle style,
        boolean maximized) {
    try {/*  www. j  ava2  s  . c  o  m*/
        Stage st = new Stage();
        stage = (Stage) lb.getScene().getWindow();
        FXMLLoader root = new FXMLLoader(getClass().getResource(load));

        Scene scene = new Scene(root.load());
        st.initStyle(style);
        st.setResizable(resize);
        st.setMaximized(maximized);
        st.setTitle(judul);
        st.setScene(scene);
        ApplicationContext appContex = config.getInstance().getApplicationContext();
        Resource resource = appContex.getResource("classpath:com/toyota/carservice/img/kallatoyota.png");
        st.getIcons().add(new Image(resource.getURI().toString()));
        st.show();
        stage.close();
        return root.getController();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}