Java Code Examples for javafx.stage.Stage#isMaximized()
The following examples show how to use
javafx.stage.Stage#isMaximized() .
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: CustomStageController.java From CustomStage with Apache License 2.0 | 6 votes |
@FXML private void maximizeRestore(MouseEvent evt){ Stage stage = ((Stage)((Node)evt.getSource()).getScene().getWindow()); if(stage.isMaximized()){ actionAdapter.restore(); if(root.getScene().getWindow().getY()<0){ root.getScene().getWindow().setY(0); } btnMax.setGraphic(new ImageView(imgMaximize)); btnMax.getTooltip().setText("Maximize"); }else{ actionAdapter.maximize(); btnMax.setGraphic(new ImageView(imgRestore)); btnMax.getTooltip().setText("Restore Down"); } }
Example 2
Source File: MementoHelper.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Save state of Stage to memento * @param memento * @param stage */ public static void saveStage(final MementoTree memento, final Stage stage) { final MementoTree stage_memento = memento.createChild(DockStage.getID(stage)); stage_memento.setNumber(X, stage.getX()); stage_memento.setNumber(Y, stage.getY()); stage_memento.setNumber(WIDTH, stage.getWidth()); stage_memento.setNumber(HEIGHT, stage.getHeight()); if (stage.isFullScreen()) stage_memento.setBoolean(FULLSCREEN, true); else if (stage.isMaximized()) stage_memento.setBoolean(MAXIMIZED, true); else if (stage.isIconified()) stage_memento.setBoolean(MINIMIZED, true); final Node node = DockStage.getPaneOrSplit(stage); savePaneOrSplit(stage_memento, node); }
Example 3
Source File: MainActivity.java From ApkToolPlus with Apache License 2.0 | 6 votes |
/** * 最小化 */ public void minimized() { Stage stage = (Stage) btnMinimized.getScene().getWindow(); if (stage.isMaximized()) { // 重置窗口大小 stage.setMaximized(false); stage.setWidth(Config.WINDOW_WIDTH); stage.setHeight(Config.WINDOW_HEIGHT); stage.centerOnScreen(); // 后台运行 Platform.runLater(() -> { stage.setIconified(true); }); } else { stage.setIconified(true); } }
Example 4
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; } }