// called at start of application @Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; this.primaryStage.setTitle("TextProApp"); try { // Load root layout from fxml FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/RootLayout.fxml")); rootLayout = (BorderPane) loader.load(); Scene scene = new Scene(rootLayout); primaryStage.setScene(scene); // min height and width calculated from components in TextAppLayout primaryStage.setMinHeight(430); primaryStage.setMinWidth(334); primaryStage.show(); } catch (Exception e) { e.printStackTrace(); } showTextProApp(); }
@Override public void start(Stage ps) throws Exception { window = ps; control = new WindowControl(); music = new MediaPlayer(new Media(Util.getResource("music.mp3").toString())); breakSound = new MediaPlayer(new Media(Util.getResource("asteroid_break.mp3").toString())); explosionSound = new MediaPlayer(new Media(Util.getResource("explosion.mp3").toString())); window.setTitle("Asteroids: Space adventure - By macjuul"); Image icon_128 = Util.getImage("icon_128.png"); Image icon_32 = Util.getImage("icon_32.png"); Image icon_16 = Util.getImage("icon_16.png"); window.getIcons().addAll(icon_128, icon_32, icon_16); window.setMinWidth(WIDTH); window.setMinHeight(HEIGHT); window.setWidth(WIDTH); window.setHeight(HEIGHT); Parent layout = (Parent) control.loadLayout(); Scene s = new Scene(layout); // Set our stylesheet s.getStylesheets().add(Util.getResource("window/style.css").toExternalForm()); s.setCursor(Cursor.CROSSHAIR); window.setScene(s); window .widthProperty() .addListener( (ObservableValue<? extends Number> ov, Number oldN, Number newN) -> { WIDTH = newN.intValue(); updateDimensions(true); }); window .heightProperty() .addListener( (ObservableValue<? extends Number> ov, Number oldN, Number newN) -> { HEIGHT = (int) newN.intValue(); updateDimensions(true); }); // Open the window window.show(); window.setOnCloseRequest( e -> { Platform.exit(); System.exit(0); }); }
@Override public void postInit(final Stage stage) { initStyles(); stage.setMinHeight(580); stage.setMinWidth(800); final Scene scene = stage.getScene(); stage.getIcons().add(new Image("images/icons/JACP_512_512.png")); // add style sheet scene.getStylesheets().add(STYLES[0]); instance[0] = this; ApplicationLauncher.latch.countDown(); }
@Override public void start(Stage primaryStage) throws Exception { log.info("Firing GUI..."); stage = primaryStage; stage.setTitle("reTRAIL demonstrator"); stage.setMinWidth(MINIMUM_WINDOW_WIDTH); stage.setMinHeight(MINIMUM_WINDOW_HEIGHT); stage.setResizable(false); MainViewController mainViewController = (MainViewController) replaceSceneContent("/META-INF/gui/mainView.fxml"); UsageController.getInstance().setMain(mainViewController); primaryStage.show(); }
private void showDialog() { if (editDialogStage == null) { editDialogStage = new Stage(); editDialogStage.setTitle("Редактирование записи"); editDialogStage.setMinHeight(150); editDialogStage.setMinWidth(300); editDialogStage.setResizable(false); editDialogStage.setScene(new Scene(fxmlEdit)); editDialogStage.initModality(Modality.WINDOW_MODAL); editDialogStage.initOwner(mainStage); } editDialogStage.showAndWait(); // для ожидания закрытия окна }
@Override public void start(Stage primaryStage) throws Exception { this.primaryStage = primaryStage; final Database database = new Database(); // FXML loader for the main scene Parent root = FXMLLoader.load(getClass().getResource("FXML/sample.fxml")); // Main scene with FXML file loaded mainScene = new Scene(root); primaryStage.setTitle("ET Database Management"); primaryStage.setScene(mainScene); // Window minimum dimensions primaryStage.setMinWidth(800); primaryStage.setMinHeight(600); // On close action for the primary stage, handles the shut down of the database server primaryStage.setOnCloseRequest( new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { try { // Shuts the server down database.serverAction(false); Platform.exit(); } catch (Exception exception) { database.createAlertDialog(exception, "The server couldn't shut down"); } } }); // Initiate Database Server try { // Starts the database server database.serverAction(true); // Show main window primaryStage.show(); } catch (Exception exception) { Alert alert = database.createAlertDialog(exception, "The database server couldn't start"); alert.showAndWait(); primaryStage.close(); } }
@FXML private void handleIncomeExpensePieChart() { final Stage stage = FXMLUtils.loadFXML( IncomeExpenseDialogController.class.getResource("IncomeExpenseDialog.fxml"), resources); stage.setTitle(resources.getString("Title.IncomeExpenseChart")); stage.setOnShown( event -> Platform.runLater( () -> { stage.setMinHeight(stage.getHeight()); stage.setMinWidth(stage.getWidth()); })); stage.show(); }
public static void showWebBrowser(String title, String url) { final Stage dialog = new Stage(); dialog.setTitle(title); WebView browser = new WebView(); WebEngine engine = browser.getEngine(); engine.load(url); Scene dialogScene = new Scene(browser); dialogScene.getStylesheets().add(ResourceManager.getUIThemeStyle()); dialog.setScene(dialogScene); dialog.setMinHeight(700); dialog.setMinWidth(1050); dialog.show(); dialog.requestFocus(); }
public void personLinkButton(ActionEvent event) throws IOException { actionClose(event); Stage stage = new Stage(); fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("..\\personality.fxml")); Parent fxmlMain = fxmlLoader.load(); // Parent root = // FXMLLoader.load(getClass().getResource("C:\\Users\\Aleksandr\\IdeaProjects\\My_Tests\\GB_Desktop_App\\src\\sample\\keywords.fxml")); stage.setTitle("Справочник Личности"); stage.setMinHeight(400); stage.setMinWidth(700); stage.setScene(new Scene(fxmlMain)); // stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(((Node) event.getSource()).getScene().getWindow()); stage.show(); System.out.println("Справочник Личности!"); // main.primaryStage.close(); }
public void start(Stage primaryStage) { GridPane pane = new GridPane(); for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { TextField text = new TextField(Integer.toString((int) (Math.random() * 2))); text.setMinWidth(WIDTH / 10.0); text.setMaxWidth(WIDTH / 10.0); text.setMinHeight(HEIGHT / 10.0); text.setMaxHeight(HEIGHT / 10.0); pane.add(text, j, i); } } Scene scene = new Scene(pane, WIDTH, HEIGHT); primaryStage.setScene(scene); primaryStage.setMinWidth(WIDTH); primaryStage.setMinHeight(HEIGHT); primaryStage.setTitle("10 by 10 matrix"); primaryStage.show(); }
/** Entry point for the JavaFX application. Configure & show the stage. */ @Override public void start(Stage primaryStage) { primaryStage.setTitle("CSSem - Lambda Expression Examples"); primaryStage.setMinWidth(JavaFXClass.MIN_WIDTH); primaryStage.setMaxWidth(JavaFXClass.MAX_WIDTH); primaryStage.setMinHeight(JavaFXClass.MIN_HEIGHT); primaryStage.setMaxHeight(JavaFXClass.MAX_HEIGHT); primaryStage.setScene(new Scene(this.layout)); Runnable stageResized = () -> this.stageResized(primaryStage.getWidth(), primaryStage.getHeight()); ChangeListener<? super Number> widthHeightListener = (v, o, n) -> stageResized.run(); primaryStage.widthProperty().addListener(widthHeightListener); primaryStage.heightProperty().addListener(widthHeightListener); primaryStage.show(); primaryStage.centerOnScreen(); stageResized.run(); }
/** * Lance l'application * * @param primaryStage objet père qui contient la fenetre principale */ @Override public void start(Stage primaryStage) throws Exception { // Chargement de la fenetre principale FXMLLoader fxmlLoader = new FXMLLoader(getClass().getClassLoader().getResource("fxml/VuePrincipale.fxml")); BorderPane root = fxmlLoader.load(); VuePrincipale vuePrincipaleControleur = (VuePrincipale) fxmlLoader.getController(); // Création du controleur de l'application Controleur controleurApplication = new Controleur(); // Passage du controleur de l'application au controleur de la vue vuePrincipaleControleur.setControleurApplication(controleurApplication); vuePrincipaleControleur.setVueGraphiqueControleurApplication(controleurApplication); vuePrincipaleControleur.initialiserObserveurs(); // Chargement de la vue des livraison FXMLLoader fxmlLoader2 = new FXMLLoader(getClass().getClassLoader().getResource("fxml/VueTextuelle.fxml")); AnchorPane anchorPane = fxmlLoader2.load(); VueTextuelle vueTextuelle = (VueTextuelle) fxmlLoader2.getController(); vueTextuelle.setAideurVueGraphique(vuePrincipaleControleur.getAideurVueGraphique()); vueTextuelle.setControleurApplication(controleurApplication); vueTextuelle.initialiserObserveurs(); BorderPane centerBorderPane = (BorderPane) root.getCenter(); centerBorderPane.setLeft(anchorPane.getChildren().get(0)); primaryStage.setTitle("Optimod'Lyon"); primaryStage.setScene(new Scene(root, LARGEUR_FENETRE, HAUTEUR_FENETRE)); primaryStage.setMinWidth(LARGEUR_FENETRE); primaryStage.setMinHeight(HAUTEUR_FENETRE); primaryStage.widthProperty().addListener(vuePrincipaleControleur.ecouteurDeRedimensionnement); primaryStage.heightProperty().addListener(vuePrincipaleControleur.ecouteurDeRedimensionnement); primaryStage.show(); }
/** Nastaví minimální výšku okna. */ public ScreenBuilder setMinHeight(double minHeight) { stage.setMinHeight(minHeight); return this; }
@Override public void start(Stage primaryStage) { importer = new DataImporter(); mainStage = primaryStage; Button btn1 = new Button(); btn1.setText("Import US Price Data"); btn1.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { chooseFile(); } }); Button btn2 = new Button(); btn2.setText("Import CAD Price Data"); btn2.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // File cadPrices = chooseFile(); File cadPrices = new File("Prices_CAD.csv"); CSVParser records = null; try { records = importer.importCsv(cadPrices); } catch (IOException e) { e.printStackTrace(); } importer.importPrices(records, Stock.Classifications.CAD.toString()); } }); Button btn3 = new Button(); btn3.setText("Import ADR Price Data"); btn3.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { chooseFile(); } }); Button btn4 = new Button(); btn4.setText("Import Price Index Data"); btn4.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { chooseFile(); } }); StackPane root = new StackPane(); Image icon = new Image(getClass().getResourceAsStream("scotiaframe.png")); mainStage.getIcons().add(icon); btn1.setTranslateY(-75); btn2.setTranslateY(-25); btn3.setTranslateY(25); btn4.setTranslateY(75); root.getChildren().add(btn1); root.getChildren().add(btn2); root.getChildren().add(btn3); root.getChildren().add(btn4); double width = 400; double height = 300; Scene scene = new Scene(root, width, height); primaryStage.setMinWidth(width); primaryStage.setMinHeight(height); primaryStage.setTitle("Moore Wealth Management"); primaryStage.setScene(scene); primaryStage.show(); }