Java Code Examples for javafx.stage.Stage#setMinWidth()
The following examples show how to use
javafx.stage.Stage#setMinWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrexApp.java From trex-stateless-gui with Apache License 2.0 | 6 votes |
@Override public void start(Stage stage) throws Exception { speedupTooltip(); primaryStage = stage; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/MainView.fxml")); AnchorPane page = fxmlLoader.load(); MainViewController mainviewcontroller = fxmlLoader.getController(); 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(780); stage.setMinHeight(700); stage.getIcons().add(new Image("/icons/trex.png")); packetBuilderAppController = injector.getInstance(AppController.class); PreferencesManager.getInstance().setPacketEditorConfigurations(packetBuilderAppController.getConfigurations()); packetBuilderAppController.registerEventBusHandler(mainviewcontroller); stage.show(); }
Example 2
Source File: Main.java From Cryogen with GNU General Public License v2.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { //iCloudTest.dryRun("email", "password"); Font.loadFont(Main.class.getResource("binResc/Roboto-Thin.ttf").toExternalForm(), 24); StaticStage.mainStage = primaryStage; primaryStage.initStyle(StageStyle.TRANSPARENT); primaryStage.setTitle("Icew1nd"); StaticStage.loadScreen(Lite.splash() ? "Splash" : "Title"); primaryStage.setMinHeight(600); primaryStage.setMinWidth(800); primaryStage.setHeight(600); primaryStage.setWidth(800); primaryStage.getIcons().addAll( //This isn't working with my ultra-high DPI. :( new Image(Main.class.getResourceAsStream("binResc/icon.png")) ); }
Example 3
Source File: Main.java From gramophy with GNU General Public License v3.0 | 6 votes |
@Override public void start(Stage primaryStage) throws Exception{ AnchorPane root = FXMLLoader.load(getClass().getResource("dash.fxml")); primaryStage.setTitle("Gramophy"); primaryStage.setMinWidth(950); primaryStage.setMinHeight(570); Scene s = new Scene(root); primaryStage.setScene(s); primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("assets/app_icon.png"))); primaryStage.show(); primaryStage.setOnCloseRequest(event -> { try { GlobalScreen.unregisterNativeHook(); } catch (Exception e) { e.printStackTrace(); } }); }
Example 4
Source File: MainGUI.java From MSPaintIDE with MIT License | 6 votes |
@Override public void start(Stage primaryStage) throws Exception { this.primaryStage = primaryStage; primaryStage.initStyle(StageStyle.UNDECORATED); primaryStage.setMinWidth(1000); primaryStage.setMinHeight(100); ProjectManager.getRecent(); if (initialProject != null) ProjectManager.switchProject(ProjectManager.readProject(initialProject)); if (ProjectManager.getPPFProject() == null) { new WelcomeWindow(this); } else { refreshProject(); } }
Example 5
Source File: MainApp.java From Motion_Profile_Generator with MIT License | 6 votes |
@Override public void start( Stage primaryStage ) { try { Pane root = FXMLLoader.load( getClass().getResource("/com/mammen/ui/javafx/main/MainUI.fxml") ); root.autosize(); primaryStage.setScene( new Scene( root ) ); primaryStage.sizeToScene(); primaryStage.setTitle("Motion Profile Generator"); primaryStage.setMinWidth( 1280 ); //1170 primaryStage.setMinHeight( 720 ); //790 primaryStage.setResizable( true ); primaryStage.show(); } catch( Exception e ) { e.printStackTrace(); } }
Example 6
Source File: AlertBox.java From SmartCity-ParkingManagement with Apache License 2.0 | 6 votes |
public void display(final String title, final String message) { window = new Stage(); window.initModality(Modality.APPLICATION_MODAL); window.setTitle(title); window.setMinWidth(250); window.setMinHeight(100); window.getIcons().add(new Image(getClass().getResourceAsStream("Smart_parking_icon.png"))); final Label label = new Label(); label.setText(message); final Button button = new Button("OK"); button.setOnAction(λ -> window.close()); final VBox layout = new VBox(); layout.getChildren().addAll(label, button); layout.setAlignment(Pos.CENTER); final Scene scene = new Scene(layout); scene.getStylesheets().add(getClass().getResource("mainStyle.css").toExternalForm()); window.setScene(scene); window.showAndWait(); }
Example 7
Source File: GUI.java From density-converter with Apache License 2.0 | 5 votes |
public static GUIController setup(Stage primaryStage, IPreferenceStore store, Dimension screenSize) throws IOException { primaryStage.setTitle("Density Converter"); ResourceBundle bundle = ResourceBundle.getBundle("bundles.strings", Locale.getDefault()); FXMLLoader loader = new FXMLLoader(GUI.class.getClassLoader().getResource("main.fxml")); loader.setResources(bundle); Parent root = loader.load(); GUIController controller = loader.getController(); controller.onCreate(primaryStage, store, bundle); if (screenSize.getHeight() <= 768) { MIN_HEIGHT = 740; } Scene scene = new Scene(root, 600, MIN_HEIGHT); primaryStage.setScene(scene); primaryStage.setResizable(true); primaryStage.setMinWidth(400); primaryStage.setMinHeight(500); primaryStage.getIcons().add(new Image("img/density_converter_icon_16.png")); primaryStage.getIcons().add(new Image("img/density_converter_icon_24.png")); primaryStage.getIcons().add(new Image("img/density_converter_icon_48.png")); primaryStage.getIcons().add(new Image("img/density_converter_icon_64.png")); primaryStage.getIcons().add(new Image("img/density_converter_icon_128.png")); primaryStage.getIcons().add(new Image("img/density_converter_icon_256.png")); return controller; }
Example 8
Source File: FinanceUI.java From StockInference-Spark with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { stage.setTitle(fxTitle); init(stage); // stage.setMinHeight(600); stage.setMinWidth(850); stage.show(); //-- Prepare Timeline prepareTimeline(); }
Example 9
Source File: BreakingNewsDemo.java From htm.java-examples with GNU Affero General Public License v3.0 | 5 votes |
public void showView(Stage stage) { Scene scene = new Scene(mainViewScroll, 1370, 1160, Color.WHITE); stage.setScene(scene); stage.setMinWidth(1370); stage.show(); Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds(); stage.setX((primScreenBounds.getWidth() - stage.getWidth()) / 2); stage.setY((primScreenBounds.getHeight() - stage.getHeight()) / 4); }
Example 10
Source File: FinanceUI.java From StockPrediction with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) { stage.setTitle(fxTitle); init(stage); // stage.setMinHeight(600); stage.setMinWidth(850); stage.show(); //-- Prepare Timeline prepareTimeline(); }
Example 11
Source File: MainApp.java From Corendon-LostLuggage with MIT License | 5 votes |
@Override public void start(Stage stage) throws Exception { //Method to set the db property setDatabase("corendonlostluggage", "root", "admin"); //set root root = FXMLLoader.load(getClass().getResource("/fxml/MainView.fxml")); Scene mainScene = new Scene(root); checkLoggedInStatus(currentUser); mainScene.getStylesheets().add("/styles/Styles.css"); stage.setTitle("Corendon Lost Luggage"); stage.setScene(mainScene); Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); stage.setX(primaryScreenBounds.getMinX()); stage.setY(primaryScreenBounds.getMinY()); stage.setWidth(primaryScreenBounds.getWidth()); stage.setHeight(primaryScreenBounds.getHeight()); stage.setMinWidth(1000); stage.setMinHeight(700); Image logo = new Image("Images/Stage logo.png"); //Image applicationIcon = new Image(getClass().getResourceAsStream("Images/Logo.png")); stage.getIcons().add(logo); stage.show(); //Set the mainstage as a property MainApp.mainStage = stage; }
Example 12
Source File: Main.java From bandit with Apache License 2.0 | 5 votes |
@Override public void start(Stage primaryStage) throws Exception{ Arm[] arms = new Arm[]{ new BernoulliArm(0.015), new BernoulliArm(0.02), new BernoulliArm(0.01) }; int numArms = arms.length; BanditAlgorithm[] algorithms = new BanditAlgorithm[]{ new EpsilonGreedyAlgorithm(numArms, 0.1), new EpsilonFirstAlgorithm(numArms, 1000), new SoftmaxAlgorithm(numArms, 0.1), new Ucb1Algorithm(numArms) }; FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/main_dialog.fxml")); MainDialog mainDialog = new MainDialog(arms, algorithms); fxmlLoader.setController(mainDialog); int minWidth = 800; int minHeight = 600; primaryStage.setTitle("Bandit Algorithms - Test framework"); primaryStage.setMinWidth(minWidth); primaryStage.setMinHeight(minHeight); primaryStage.setOnCloseRequest(mainDialog::handle); primaryStage.setScene(new Scene(fxmlLoader.load(), minWidth, minHeight)); primaryStage.show(); }
Example 13
Source File: Visualizer.java From HdrHistogramVisualizer with Apache License 2.0 | 5 votes |
@Override public void start(Stage stage) throws Exception { VisualizerView root = new VisualizerView(); Scene scene = new Scene(root.getView()); stage.setMinWidth(500); stage.setMinHeight(550); stage.setTitle("HdrHistogram Visualizer"); stage.setScene(scene); stage.show(); // Auto load css file registerCssChangeListener(root.getView().getStylesheets(), Paths.get("visualizer.css")); }
Example 14
Source File: ConfirmBox.java From SmartCity-ParkingManagement with Apache License 2.0 | 5 votes |
public boolean display(final String title, final String message) { final Stage window = new Stage(); window.initModality(Modality.APPLICATION_MODAL); window.setTitle(title); window.setMinWidth(250); window.setMinHeight(150); window.getIcons().add(new Image(getClass().getResourceAsStream("Smart_parking_icon.png"))); final Label label = new Label(); label.setText(message); yesButton = new Button("Yes"); yesButton.setOnAction(λ -> { answer = true; window.close(); }); noButton = new Button("No"); noButton.setOnAction(λ -> { answer = false; window.close(); }); final VBox layout = new VBox(); layout.getChildren().addAll(label, noButton, yesButton); layout.setAlignment(Pos.CENTER); final Scene scene = new Scene(layout); scene.getStylesheets().add(getClass().getResource("mainStyle.css").toExternalForm()); window.setScene(scene); window.showAndWait(); return answer; }
Example 15
Source File: Game2048.java From util4j with Apache License 2.0 | 4 votes |
/** * * @param primaryStage */ @Override public void start(Stage primaryStage) { gameManager = new GameManager(); gameBounds = gameManager.getLayoutBounds(); StackPane root = new StackPane(gameManager); root.getStyleClass().addAll("game-root"); ChangeListener<Number> resize = (ov, v, v1) -> { double scale = Math.min((root.getWidth() - MARGIN) / gameBounds.getWidth(), (root.getHeight() - MARGIN) / gameBounds.getHeight()); gameManager.setScale(scale); gameManager.setLayoutX((root.getWidth() - gameBounds.getWidth()) / 2d); gameManager.setLayoutY((root.getHeight() - gameBounds.getHeight()) / 2d); }; root.widthProperty().addListener(resize); root.heightProperty().addListener(resize); Scene scene = new Scene(root); scene.getStylesheets().add(CSS); addKeyHandler(scene); addSwipeHandlers(scene); if (isARMDevice()) { primaryStage.setFullScreen(true); primaryStage.setFullScreenExitHint(""); } if (Platform.isSupported(ConditionalFeature.INPUT_TOUCH)) { scene.setCursor(Cursor.NONE); } Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds(); double factor = Math.min(visualBounds.getWidth() / (gameBounds.getWidth() + MARGIN), visualBounds.getHeight() / (gameBounds.getHeight() + MARGIN)); primaryStage.setTitle("2048FX"); primaryStage.setScene(scene); primaryStage.setMinWidth(gameBounds.getWidth() / 2d); primaryStage.setMinHeight(gameBounds.getHeight() / 2d); primaryStage.setWidth((gameBounds.getWidth() + MARGIN) * factor); primaryStage.setHeight((gameBounds.getHeight() + MARGIN) * factor); primaryStage.show(); }
Example 16
Source File: WelcomeWizard.java From Lipi with MIT License | 4 votes |
public static void openDirBlog(File blogDir, Stage primaryStage) { if (blogDir != null) { try { primaryStage.close(); String selectedDirPath = blogDir.getCanonicalPath(); //history is saved WelcomeWizard.storeBlogHistory(selectedDirPath); TomlConfig tomlConfig = new TomlConfig(selectedDirPath + File.separator + "config.toml"); primaryStage.setTitle("Blog Dashboard: " + tomlConfig.getTomlMap().get("title").toString() + " - Lipi"); Stage editorStage = new Stage(); editorStage.setTitle("Lipi Post Editor"); TabbedHMDPostEditor t = new TabbedHMDPostEditor(editorStage); t.getStylesheets().add(Paths.get("res/material.css").toAbsolutePath().toUri().toString()); t.getStylesheets().add(Paths.get("res/custom.css").toAbsolutePath().toUri().toString()); editorStage.setScene(new Scene(t)); editorStage.getIcons().add( new Image(Paths.get("res/lipi-hmdeditor-icon.png").toAbsolutePath().toUri().toString()) ); DashboardMain mainDashboard = new DashboardMain(selectedDirPath, t); VBox holder = new VBox(); // holder.setMinHeight(680); holder.setMinWidth(1000); holder.getChildren().add(mainDashboard); holder.getStylesheets().add(Paths.get("res/material.css").toAbsolutePath().toUri().toString()); holder.getStylesheets().add(Paths.get("res/custom.css").toAbsolutePath().toUri().toString()); Scene scene = new Scene(holder); primaryStage.setScene(scene); // primaryStage.setMinHeight(680); primaryStage.setMinWidth(1000); primaryStage.show(); primaryStage.centerOnScreen(); } catch (IOException e) { ExceptionAlerter.showException(e); e.getMessage(); } } }
Example 17
Source File: JfxApplication.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
@Override @FxThread public void start(@NotNull Stage stage) throws Exception { JfxApplication.instance = this; this.stage = stage; addWindow(stage); try { // initialize javaFX events in javaFX thread. ArrayFactory.asArray(ComboBoxBase.ON_SHOWN); var resourceManager = ResourceManager.getInstance(); resourceManager.reload(); var initializationManager = InitializationManager.getInstance(); initializationManager.onBeforeCreateJavaFxContext(); var pluginManager = PluginManager.getInstance(); pluginManager.handlePlugins(editorPlugin -> editorPlugin.register(CssRegistry.getInstance())); LogView.getInstance(); SvgImageLoaderFactory.install(); ImageIO.read(getClass().getResourceAsStream("/ui/icons/test/test.jpg")); var icons = stage.getIcons(); icons.add(new Image("/ui/icons/app/256x256.png")); icons.add(new Image("/ui/icons/app/128x128.png")); icons.add(new Image("/ui/icons/app/96x96.png")); icons.add(new Image("/ui/icons/app/64x64.png")); icons.add(new Image("/ui/icons/app/48x48.png")); icons.add(new Image("/ui/icons/app/32x32.png")); icons.add(new Image("/ui/icons/app/24x24.png")); icons.add(new Image("/ui/icons/app/16x16.png")); var config = EditorConfig.getInstance(); stage.initStyle(StageStyle.DECORATED); stage.setMinHeight(600); stage.setMinWidth(800); stage.setWidth(config.getScreenWidth()); stage.setHeight(config.getScreenHeight()); stage.setMaximized(config.isMaximized()); stage.setTitle(Config.TITLE); stage.show(); if (!stage.isMaximized()) { stage.centerOnScreen(); } stage.widthProperty().addListener((observable, oldValue, newValue) -> { if (stage.isMaximized()) return; config.setScreenWidth(newValue.intValue()); }); stage.heightProperty().addListener((observable, oldValue, newValue) -> { if (stage.isMaximized()) return; config.setScreenHeight(newValue.intValue()); }); stage.maximizedProperty() .addListener((observable, oldValue, newValue) -> config.setMaximized(newValue)); buildScene(); } catch (Throwable e) { LOGGER.error(this, e); throw e; } }
Example 18
Source File: MZmineGUI.java From old-mzmine3 with GNU General Public License v2.0 | 4 votes |
public void start(Stage stage) { try { // Load the main window URL mainFXML = new URL(mzMineFXML); FXMLLoader loader = new FXMLLoader(mainFXML); rootScene = loader.load(); mainWindowController = loader.getController(); stage.setScene(rootScene); } catch (IOException e) { e.printStackTrace(); logger.error("Error loading MZmine GUI from FXML: " + e); Platform.exit(); } stage.setTitle("MZmine " + MZmineCore.getMZmineVersion()); stage.setMinWidth(300); stage.setMinHeight(300); // Set application icon stage.getIcons().setAll(mzMineIcon); stage.setOnCloseRequest(e -> { requestQuit(); e.consume(); }); // Activate new GUI-supported project MZmineGUIProject project = new MZmineGUIProject(); MZmineGUI.activateProject(project); stage.show(); // Check for new version of MZmine NewVersionCheck NVC = new NewVersionCheck(CheckType.DESKTOP); Thread nvcThread = new Thread(NVC); nvcThread.setPriority(Thread.MIN_PRIORITY); nvcThread.start(); }
Example 19
Source File: Fx3DVisualizerModule.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
@Override public @Nonnull ExitCode runModule(@Nonnull MZmineProject project, @Nonnull ParameterSet parameters, @Nonnull Collection<Task> tasks) { final RawDataFile[] currentDataFiles = parameters .getParameter(Fx3DVisualizerParameters.dataFiles).getValue().getMatchingRawDataFiles(); final ScanSelection scanSel = parameters.getParameter(Fx3DVisualizerParameters.scanSelection).getValue(); final List<Feature> featureSelList = parameters.getParameter(Fx3DVisualizerParameters.features).getValue(); logger.finest("Feature selection is:" + featureSelList.toString()); Range<Double> rtRange = ScanUtils.findRtRange(scanSel .getMatchingScans(MZmineCore.getProjectManager().getCurrentProject().getDataFiles()[0])); ParameterSet myParameters = MZmineCore.getConfiguration().getModuleParameters(Fx3DVisualizerModule.class); Range<Double> mzRange = myParameters.getParameter(Fx3DVisualizerParameters.mzRange).getValue(); int rtRes = myParameters.getParameter(Fx3DVisualizerParameters.rtResolution).getValue(); int mzRes = myParameters.getParameter(Fx3DVisualizerParameters.mzResolution).getValue(); if (!Platform.isSupported(ConditionalFeature.SCENE3D)) { MZmineCore.getDesktop().displayErrorMessage("The platform does not provide 3D support."); return ExitCode.ERROR; } FXMLLoader loader = new FXMLLoader((getClass().getResource("Fx3DStage.fxml"))); Stage stage = null; try { stage = loader.load(); logger.finest("Stage has been successfully loaded from the FXML loader."); } catch (Exception e) { e.printStackTrace(); return ExitCode.ERROR; } String title = ""; Fx3DStageController controller = loader.getController(); controller.setScanSelection(scanSel); controller.setRtAndMzResolutions(rtRes, mzRes); controller.setRtAndMzValues(rtRange, mzRange); for (int i = 0; i < currentDataFiles.length; i++) { MZmineCore.getTaskController().addTask( new Fx3DSamplingTask(currentDataFiles[i], scanSel, mzRange, rtRes, mzRes, controller), TaskPriority.HIGH); } controller.addFeatureSelections(featureSelList); for (int i = 0; i < currentDataFiles.length; i++) { title = title + currentDataFiles[i].toString() + " "; } stage.show(); stage.setMinWidth(400.0); stage.setMinHeight(400.0); return ExitCode.OK; }
Example 20
Source File: NSLMain.java From ns-usbloader with GNU General Public License v3.0 | 4 votes |
@Override public void start(Stage primaryStage) throws Exception{ FXMLLoader loader = new FXMLLoader(getClass().getResource("/NSLMain.fxml")); Locale userLocale = new Locale(AppPreferences.getInstance().getLanguage()); // NOTE: user locale based on ISO3 Language codes ResourceBundle rb = ResourceBundle.getBundle("locale", userLocale); loader.setResources(rb); Parent root = loader.load(); primaryStage.getIcons().addAll( new Image(getClass().getResourceAsStream("/res/app_icon32x32.png")), new Image(getClass().getResourceAsStream("/res/app_icon48x48.png")), new Image(getClass().getResourceAsStream("/res/app_icon64x64.png")), new Image(getClass().getResourceAsStream("/res/app_icon128x128.png")) ); primaryStage.setTitle("NS-USBloader "+appVersion); primaryStage.setMinWidth(650); primaryStage.setMinHeight(450); Scene mainScene = new Scene(root, AppPreferences.getInstance().getSceneWidth(), AppPreferences.getInstance().getSceneHeight() ); mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme()); primaryStage.setScene(mainScene); primaryStage.show(); primaryStage.setOnCloseRequest(e->{ if (MediatorControl.getInstance().getTransferActive()) if(! ServiceWindow.getConfirmationWindow(rb.getString("windowTitleConfirmExit"), rb.getString("windowBodyConfirmExit"))) e.consume(); }); NSLMainController controller = loader.getController(); controller.setHostServices(getHostServices()); primaryStage.setOnHidden(e-> { AppPreferences.getInstance().setSceneHeight(mainScene.getHeight()); AppPreferences.getInstance().setSceneWidth(mainScene.getWidth()); controller.exit(); }); }