Example usage for javafx.stage Stage setResizable

List of usage examples for javafx.stage Stage setResizable

Introduction

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

Prototype

public final void setResizable(boolean value) 

Source Link

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  . j  av  a 2  s  . c o m
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:org.kordamp.javatrove.example04.Launcher.java

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setScene(view.createScene());
    primaryStage.sizeToScene();/*from   w w  w  .j  ava2s  .  co  m*/
    primaryStage.setResizable(false);
    primaryStage.show();
}

From source file:account.management.controller.ViewSalaryVoucherController.java

/**
 * Initializes the controller class.//from   ww  w  . ja  v a 2  s  .c  o m
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    this.voucher_no.setCellValueFactory(new PropertyValueFactory("id"));
    this.date.setCellValueFactory(new PropertyValueFactory("date"));
    this.section.setCellValueFactory(new PropertyValueFactory("section"));
    this.name.setCellValueFactory(new PropertyValueFactory("name"));
    this.basis.setCellValueFactory(new PropertyValueFactory("basis"));
    this.amount.setCellValueFactory(new PropertyValueFactory("total"));

    final ContextMenu contextMenu = new ContextMenu();
    MenuItem item1 = new MenuItem("    View                  ");
    item1.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent e) {
            Data.salaryVoucher = table.getSelectionModel().getSelectedItem();

            try {
                Parent root = FXMLLoader
                        .load(getClass().getResource(MetaData.viewPath + "EditSalaryVoucher.fxml"));
                Scene scene = new Scene(root);
                Stage stage = new Stage();
                scene.setRoot(root);
                stage.setResizable(false);
                stage.setTitle("Salary Voucher");
                stage.setScene(scene);
                stage.showAndWait();
                int index = table.getSelectionModel().getSelectedIndex();
                getData();

            } catch (IOException ex) {
                Logger.getLogger(ViewSalaryVoucherController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    });
    contextMenu.getItems().addAll(item1);
    this.table.setContextMenu(contextMenu);

}

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);// www  . ja v  a 2s . c  o  m
    aboutStage.setResizable(false);
    aboutStage.setTitle(resources.getString("Help.AboutDialog.Title"));
    aboutStage.setScene(scene);
    initCloseOnEscape(aboutStage);
    return aboutStage;
}

From source file:account.management.controller.loginController.java

@FXML
private void onLoginButtonClick(ActionEvent event) {
    try {/*from ww  w  .ja  va 2s  .c  o m*/

        String username = this.username.getText();
        String password = this.password.getText();

        User.username = username;

        this.login_btn.setDisable(true);
        this.login_btn.setText("Loading...");
        Thread t = new Thread(() -> {
            try {
                HttpResponse<JsonNode> res = Unirest.get(MetaData.baseUrl + "login")
                        .queryString("username", username).queryString("password", password).asJson();
                JSONArray array = res.getBody().getArray();
                JSONObject obj = array.getJSONObject(0);
                if (obj.getInt("inventory") == 1)
                    User.inventory = true;
                if (obj.getInt("project") == 1)
                    User.project = true;
                if (obj.getInt("lc") == 1)
                    User.lc = true;
                if (obj.getInt("cnf") == 1)
                    User.cnf = true;
                if (obj.getInt("deposit_voucher") == 1)
                    User.deposit_voucher = true;
                if (obj.getInt("expense_voucher") == 1)
                    User.expense_voucher = true;
                if (obj.getInt("sell") == 1)
                    User.sell = true;
                if (obj.getInt("purchase") == 1)
                    User.purchase = true;
                if (obj.getInt("party_create") == 1)
                    User.party_create = true;
                if (obj.getInt("ledger_create") == 1)
                    User.ledger = true;
                if (obj.getInt("voucher") == 1)
                    User.voucher = true;
                if (obj.getInt("bank") == 1)
                    User.bank = true;
                if (obj.getInt("inventory_report") == 1)
                    User.inventory_report = true;
                if (obj.getInt("trial_balance") == 1)
                    User.trial_balance = true;
                if (obj.getInt("balance_sheet") == 1)
                    User.balance_sheet = true;
                if (obj.getInt("financial_statement") == 1)
                    User.financial_statement = true;
                if (obj.getInt("database_maintanance") == 1)
                    User.database_maintanance = true;

                Platform.runLater(() -> {
                    try {
                        this.login_btn.getScene().getWindow().hide();
                        Parent root;
                        root = FXMLLoader.load(getClass().getResource(MetaData.viewPath + "home1.fxml"));
                        Scene scene = new Scene(root);
                        scene.getStylesheets().add("/style.css");
                        Stage stage = new Stage();
                        scene.setRoot(root);
                        stage.setResizable(true);
                        stage.setTitle("Home");
                        stage.setScene(scene);
                        stage.showAndWait();
                    } catch (IOException ex) {
                        Logger.getLogger(loginController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                });

            } catch (Exception ex) {
                Platform.runLater(() -> {
                    Msg.showError("Username or password is incorrect");
                });
            } finally {
                login_btn.setDisable(false);
                Platform.runLater(() -> {
                    login_btn.setText("Login");

                });

            }
        });
        t.start();

    } catch (Exception e) {
        Msg.showError("Sorry. There is an error. Please try again");
    }
}

From source file:ninja.eivind.hotsreplayuploader.Client.java

@Override
public void start(final Stage primaryStage) throws Exception {
    try {/*w  ww .java 2s.  co m*/
        final URL logo = platformService.getLogoUrl();
        final Image image = new Image(logo.toString());
        primaryStage.getIcons().add(image);
        primaryStage.setResizable(false);
        addToTray(primaryStage);
        platformService.setupWindowBehaviour(primaryStage);

        // Set window title
        final String windowTitle = Constants.APPLICATION_NAME + " v" + releaseManager.getCurrentVersion();
        primaryStage.setTitle(windowTitle);

        Scene scene = sceneBuilderFactory.builder()
                .setLocation("/ninja/eivind/hotsreplayuploader/window/Home.fxml").build();

        primaryStage.setScene(scene);
        primaryStage.show();
    } catch (Exception e) {
        LOG.error("Failed to start", e);
        throw e;
    }
}

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 {//  w ww.  j  a  va 2  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();
        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  . jav  a  2s.  com
        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 {//  w w  w.j ava2s .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.exalttech.trex.ui.UIBaseTest.java

@Override
public void start(Stage stage) throws Exception {
    TrexApp.setPrimaryStage(stage);/*from   w  w  w.  j  a v  a2 s  .c  o  m*/
    AnchorPane page = (AnchorPane) FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml"));
    Scene scene = new Scene(page);
    scene.getStylesheets().add(TrexApp.class.getResource("/styles/mainStyle.css").toExternalForm());
    stage.setScene(scene);
    stage.setTitle("TRex");
    stage.setResizable(true);
    stage.setMinWidth(1100);
    stage.setMinHeight(670);
    stage.show();
}