@Override public void layoutChildren() { super.layoutChildren(); if (dialog.getMinWidth() > 0 && dialog.getMinHeight() > 0) { return; } double minWidth = Math.max(0, computeMinWidth(getHeight()) + (dialog.getWidth() - customScene.getWidth())); double minHeight = Math.max(0, computeMinHeight(getWidth()) + (dialog.getHeight() - customScene.getHeight())); dialog.setMinWidth(minWidth); dialog.setMinHeight(minHeight); } }
public class ClientGUI extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("ClientGUI.fxml")); scene = new Scene(root, 480, 360); stage.setTitle("MyMessenger"); stage.setScene(scene); stage.setMinWidth(660); stage.setMinHeight(495); stage.setMaxWidth(990); stage.show(); } }
@Override public void start(Stage primaryStage) { StackPane root = new StackPane(); Scene scene = new Scene(root, 800, 600); primaryStage.setScene(scene); System.out.println("before sceneW " + scene.getWidth()); System.out.println("before sceneH " + scene.getHeight()); System.out.println("before stageW " + primaryStage.getWidth()); System.out.println("before stageH " + primaryStage.getHeight()); primaryStage.show(); System.out.println("after sceneW " + scene.getWidth()); System.out.println("after sceneH " + scene.getHeight()); System.out.println("after stageW " + primaryStage.getWidth()); System.out.println("after stageH " + primaryStage.getHeight()); primaryStage.setMinWidth(primaryStage.getWidth()); primaryStage.setMinHeight(primaryStage.getHeight()); }
public class Main extends Application { public static void main(String args[]){ launch(args); } @Override public void start(Stage stage) throws Exception { CardModel model = new CardModel(); CardView scene = new CardView(stage); CardController controller= new CardController(model,scene); stage.setTitle("Title"); stage.setMaximized(true); stage.setMinWidth(500); stage.setMinHeight(550); stage.setScene(scene); stage.show(); } }
public static void show() { FOKLogger.info(ReportingDialog.class.getName(), "Showing the ReportingDialogUploadProgress..."); stage = new Stage(); Parent root; try { String details = ""; root = FXMLLoader.load(ReportingDialogUploadProgress.class.getResource("ReportingDialogUploadProgress.fxml")); Scene scene = new Scene(root); scene.getStylesheets().add(ReportingDialogUploadProgress.class.getResource("ReportingDialog.css").toExternalForm()); stage.setMinWidth(scene.getRoot().minWidth(0) + 70); stage.setMinHeight(scene.getRoot().minHeight(0) + 70); stage.setScene(scene); stage.show(); } catch (IOException e2) { FOKLogger.log(ReportingDialog.class.getName(), Level.SEVERE, FOKLogger.DEFAULT_ERROR_TEXT, e2); } }
/** * Inits the min stage height. */ private void initMinStageHeight() { if ( _stage != null && _scene != null ) { if ( Double.isNaN( _bordersV ) ) { initBordersV( _scene.getHeight() ); } else { int theHeight = (int) _bordersV; theHeight += (getViewportHeight() * getFieldHeight() + getViewportHeight() * getFieldGap()); _stage.setMinHeight( theHeight + _windowDecorationV ); } } }
stage.setMinHeight(MINIMUM_WINDOW_HEIGHT);
private void afegir(ActionEvent event) throws IOException { FXMLLoader loader = new FXMLLoader(getClass().getResource("/model/Afegir.fxml")); Parent root = loader.load(); //load the correct controller AfegirController controller = loader.getController(); Scene scene = new Scene(root); Stage ventana2= new Stage(); ventana2.setMinHeight(380); ventana2.getIcons().add(new Image("/estil/Boo.png")); ventana2.setMinWidth(770); ventana2.setTitle("Afegir dades"); ventana2.initModality(Modality.APPLICATION_MODAL); ventana2.setScene(scene); taula.subs = new ObservableList<Subvencio>(); ventana2.showAndWait(); //Add the sub to Observable list here and add the observableList to tableview. subs.add(controller.getSub()); tabla.setItems(subs); }
private void show(String windowTitle) { stage = new Stage(); Parent root; try { root = FXMLLoader.load(MOTDDialog.class.getResource("MOTDDialog.fxml"), bundle); scene = new Scene(root); stage.getIcons().add(new Image(new URL(motd.getImage().getUrl()).openStream())); // scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); // Set the window title stage.setTitle(windowTitle); stage.setMinWidth(scene.getRoot().minWidth(0) + 70); stage.setMinHeight(scene.getRoot().minHeight(0) + 70); stage.setScene(scene); stage.show(); } catch (IOException e) { FOKLogger.log(MOTDDialog.class.getName(), Level.SEVERE, FOKLogger.DEFAULT_ERROR_TEXT, e); } }
public void show(boolean autoHide) { Platform.runLater(() -> { _beforeShow(); Stage dialogStage = dialogStageWrapper.getDialogStage(); dialogStage.setMinWidth(340); dialogStage.setMaxWidth(340); if(hideFooter) { dialogStage.setMinHeight(164); dialogStage.setMaxHeight(164); } else { dialogStage.setMinHeight(236); dialogStage.setMaxHeight(236); } if(autoHide) { dialogStageWrapper.show(autoHide); } else { dialogStageWrapper.show(); } }); }
@Override public void layoutChildren() { super.layoutChildren(); if (dialog.getMinWidth() > 0 && dialog.getMinHeight() > 0) { return; } double minWidth = Math.max(0, computeMinWidth(getHeight()) + (dialog.getWidth() - customScene.getWidth())); double minHeight = Math.max(0, computeMinHeight(getWidth()) + (dialog.getHeight() - customScene.getHeight())); dialog.setMinWidth(minWidth); dialog.setMinHeight(minHeight); } }
private void show(UpdateInfo update) { stage = new Stage(); Parent root; try { if (update != null) { if (update.fileSizeInMB != -1) { messageText = "Filesize: " + (Math.round(update.fileSizeInMB * 100)) / 100.0 + " MB, Version to download: " + update.toVersion.toString(); } else { // File sie unknown, see Javadoc of UpdateInfo messageText = "Filesize: unknown, Version to download: " + update.toVersion.toString(); } } updateInfo = update; root = FXMLLoader.load(UpdateAvailableDialog.class.getResource("AlertDialog.fxml"), bundle); Scene scene = new Scene(root); // scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); // Set the window title and put the app name in it stage.setTitle(bundle.getString("window.Title").replace("{appName}", Common.getInstance().getAppName())); stage.setMinWidth(scene.getRoot().minWidth(0) + 70); stage.setMinHeight(scene.getRoot().minHeight(0) + 70); stage.setScene(scene); stage.show(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
stage.setMinHeight(scene.getRoot().minHeight(0) + 70);
/** * {@inheritDoc} */ @Override public void start(final Stage initStage) throws Exception { preloaderStage = initStage; URL fxmlLocation = EPDesktopPreloader.class.getResource("EPDesktopPreloader.fxml"); loadFXML(fxmlLocation); Scene splashScene = new Scene(rootPane); initStage.setScene(splashScene); initStage.setMinWidth(400); initStage.setMinHeight(400); initStage.setWidth(width); initStage.setHeight(height); initStage.initStyle(StageStyle.UNDECORATED); animateWaitingLabel(); initStage.show(); }
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean showing) { if(showing) primaryStage.setMinHeight(primaryStage.getHeight()); primaryStage.setMinWidth(primaryStage.getWidth()); primaryStage.setTitle("My mininal size is: W"+ primaryStage.getMinWidth()+" H"+primaryStage.getMinHeight());
Hyperlink link = new Hyperlink("TEST"); link.setOnAction(new EventHandler<ActionEvent>() { @override public void handle(ActionEvent e) { Stage stage = new Stage(); TextArea text = new TextArea(): VBox vbox = new VBox(); Button close = new Button(); close.setText("Close"); close.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { stage.close(); } }); vbox.getChildren().addAll(text, close); Scene scene = new Scene(vbox); stage.setScene(scene); stage.setMinWidth(100); stage.setMinHeight(100); stage.show(); // ... text.setText("update"); } });
/** * This method is called by {@link FxUiManager} and is the first call that is made after {@link * FxUiManager#startGui(Stage)} is called. * <p> * Here we mostly do some post-processing to: * <ul> * <li>Disable closure of the application on closure of main stage</li> * <li>Treating closure of main stage as a request to hide it</li> * <li>Set-up minimum stage size constraints</li> * <li>Register it again {@link StageManager} for retrieval in various places</li> * </ul> * * @param mainStage The application's main stage. */ @Override protected void onStageCreated(final Stage mainStage) { Platform.setImplicitExit(false); mainStage.setOnCloseRequest(e -> handleMainStageClosure(mainStage)); mainStage.setMinHeight(environment.getRequiredProperty("mainStage.minHeight", Integer.class)); mainStage.setMinWidth(environment.getRequiredProperty("mainStage.minWidth", Integer.class)); mainStage.setWidth(600.0); mainStage.setHeight(500.0); stageManager.registerSingle(Screen.ROOT_VIEW, mainStage); }
arg0.setScene(c); arg0.setMinWidth(500); arg0.setMinHeight(500); arg0.show();
primaryStage().setMinHeight(screenMinHeight()); primaryStage().setMinWidth(screenMinWidth()); primaryStage().setWidth(screenWidth()); primaryStage().setMinHeight(screenMinHeight()); primaryStage().setMinWidth(screenMinWidth()); primaryStage().setWidth(screenWidth());
stage.setMinHeight(region.getMinHeight());