< prev index next >

modules/javafx.graphics/src/main/java/javafx/stage/Window.java

Print this page
rev 10598 : 8185767: Fix broken links in Javadocs


 452             @Override
 453             protected void invalidated() {
 454                 updateRenderScales(getOutputScaleX(),
 455                                    getOutputScaleY());
 456             }
 457         };
 458     public final void setForceIntegerRenderScale(boolean forced) {
 459         forceIntegerRenderScale.set(forced);
 460     }
 461     public final boolean isForceIntegerRenderScale() {
 462         return forceIntegerRenderScale.get();
 463     }
 464     public final BooleanProperty forceIntegerRenderScaleProperty() {
 465         return forceIntegerRenderScale;
 466     }
 467 
 468     /**
 469      * The horizontal scale that the {@code Window} will use when rendering
 470      * its {@code Scene} to the rendering buffer.
 471      * This property is automatically updated whenever there is a change in
 472      * the {@link outputScaleX} property and can be overridden either by
 473      * calling {@code setRenderScaleX()} in response to a listener on the
 474      * {@code outputScaleX} property or by binding it appropriately.
 475      *
 476      * @defaultValue outputScaleX
 477      * @see #outputScaleXProperty()
 478      * @see #forceIntegerRenderScaleProperty()
 479      * @since 9
 480      */
 481     private DoubleProperty renderScaleX =
 482         new SimpleDoubleProperty(this, "renderScaleX", 1.0) {
 483             @Override
 484             protected void invalidated() {
 485                 peerBoundsConfigurator.setRenderScaleX(get());
 486             }
 487         };
 488     public final void setRenderScaleX(double scale) {
 489         renderScaleX.set(scale);
 490     }
 491     public final double getRenderScaleX() {
 492         return renderScaleX.get();
 493     }
 494     public final DoubleProperty renderScaleXProperty() {
 495         return renderScaleX;
 496     }
 497 
 498     /**
 499      * The vertical scale that the {@code Window} will use when rendering
 500      * its {@code Scene} to the rendering buffer.
 501      * This property is automatically updated whenever there is a change in
 502      * the {@link outputScaleY} property and can be overridden either by
 503      * calling {@code setRenderScaleY()} in response to a listener on the
 504      * {@code outputScaleY} property or by binding it appropriately.
 505      *
 506      * @defaultValue outputScaleY
 507      * @see #outputScaleYProperty()
 508      * @see #forceIntegerRenderScaleProperty()
 509      * @since 9
 510      */
 511     private DoubleProperty renderScaleY =
 512         new SimpleDoubleProperty(this, "renderScaleY", 1.0) {
 513             @Override
 514             protected void invalidated() {
 515                 peerBoundsConfigurator.setRenderScaleY(get());
 516             }
 517         };
 518     public final void setRenderScaleY(double scale) {
 519         renderScaleY.set(scale);
 520     }
 521     public final double getRenderScaleY() {
 522         return renderScaleY.get();
 523     }
 524     public final DoubleProperty renderScaleYProperty() {
 525         return renderScaleY;
 526     }
 527 
 528     private boolean xExplicit = false;
 529     /**
 530      * The horizontal location of this {@code Window} on the screen. Changing
 531      * this attribute will move the {@code Window} horizontally. If this
 532      * {@code Window} is an instance of {@code Stage}, changing this attribute
 533      * will not visually affect the {@code Window} while
 534      * {@link Stage#fullScreenProperty fullScreen} is true, but will be honored
 535      * by the {@code Window} once {@link Stage#fullScreenProperty fullScreen}
 536      * becomes false.
 537      */
 538     private ReadOnlyDoubleWrapper x =
 539             new ReadOnlyDoubleWrapper(this, "x", Double.NaN);
 540 
 541     public final void setX(double value) {
 542         setXInternal(value);
 543     }
 544     public final double getX() { return x.get(); }
 545     public final ReadOnlyDoubleProperty xProperty() { return x.getReadOnlyProperty(); }
 546 
 547     void setXInternal(double value) {
 548         x.set(value);
 549         peerBoundsConfigurator.setX(value, 0);
 550         xExplicit = true;
 551     }
 552 
 553     private boolean yExplicit = false;
 554     /**
 555      * The vertical location of this {@code Window} on the screen. Changing this
 556      * attribute will move the {@code Window} vertically. If this
 557      * {@code Window} is an instance of {@code Stage}, changing this attribute
 558      * will not visually affect the {@code Window} while
 559      * {@link Stage#fullScreenProperty fullScreen} is true, but will be honored
 560      * by the {@code Window} once {@link Stage#fullScreenProperty fullScreen}
 561      * becomes false.
 562      */
 563     private ReadOnlyDoubleWrapper y =
 564             new ReadOnlyDoubleWrapper(this, "y", Double.NaN);
 565 
 566     public final void setY(double value) {
 567         setYInternal(value);
 568     }
 569     public final double getY() { return y.get(); }
 570     public final ReadOnlyDoubleProperty yProperty() { return y.getReadOnlyProperty(); }
 571 
 572     void setYInternal(double value) {
 573         y.set(value);
 574         peerBoundsConfigurator.setY(value, 0);
 575         yExplicit = true;
 576     }
 577 
 578     /**
 579      * Notification from the windowing system that the window's position has
 580      * changed.


 582      * @param newX the new window x position
 583      * @param newY the new window y position
 584      */
 585     void notifyLocationChanged(double newX, double newY) {
 586         x.set(newX);
 587         y.set(newY);
 588     }
 589 
 590     private boolean widthExplicit = false;
 591 
 592     /**
 593      * The width of this {@code Window}. Changing this attribute will narrow or
 594      * widen the width of the {@code Window}. This value includes any and all
 595      * decorations which may be added by the Operating System such as resizable
 596      * frame handles. Typical applications will set the {@link javafx.scene.Scene}
 597      * width instead. This {@code Window} will take its width from the scene if
 598      * it has never been set by the application. Resizing the window by end user
 599      * does not count as a setting the width by the application. If this
 600      * {@code Window} is an instance of {@code Stage}, changing this attribute
 601      * will not visually affect the {@code Window} while
 602      * {@link Stage#fullScreenProperty fullScreen} is true, but will be honored
 603      * by the {@code Window} once {@link Stage#fullScreenProperty fullScreen}
 604      * becomes false.
 605      * <p>
 606      * The property is read only because it can be changed externally
 607      * by the underlying platform and therefore must not be bindable.
 608      * </p>
 609      */
 610     private ReadOnlyDoubleWrapper width =
 611             new ReadOnlyDoubleWrapper(this, "width", Double.NaN);
 612 
 613     public final void setWidth(double value) {
 614         width.set(value);
 615         peerBoundsConfigurator.setWindowWidth(value);
 616         widthExplicit = true;
 617     }
 618     public final double getWidth() { return width.get(); }
 619     public final ReadOnlyDoubleProperty widthProperty() { return width.getReadOnlyProperty(); }
 620 
 621     private boolean heightExplicit = false;
 622     /**
 623      * The height of this {@code Window}. Changing this attribute will shrink
 624      * or heighten the height of the {@code Window}. This value includes any and all
 625      * decorations which may be added by the Operating System such as the title
 626      * bar. Typical applications will set the {@link javafx.scene.Scene} height
 627      * instead. This window will take its height from the scene if it has never
 628      * been set by the application. Resizing this window by end user does not
 629      * count as a setting the height by the application.  If this
 630      * {@code Window} is an instance of {@code Stage}, changing this attribute
 631      * will not visually affect the {@code Window} while
 632      * {@link Stage#fullScreenProperty fullScreen} is true, but will be honored
 633      * by the {@code Window} once {@link Stage#fullScreenProperty fullScreen}
 634      * becomes false.
 635      * <p>
 636      * The property is read only because it can be changed externally
 637      * by the underlying platform and therefore must not be bindable.
 638      * </p>
 639      */
 640     private ReadOnlyDoubleWrapper height =
 641             new ReadOnlyDoubleWrapper(this, "height", Double.NaN);
 642 
 643     public final void setHeight(double value) {
 644         height.set(value);
 645         peerBoundsConfigurator.setWindowHeight(value);
 646         heightExplicit = true;
 647     }
 648     public final double getHeight() { return height.get(); }
 649     public final ReadOnlyDoubleProperty heightProperty() { return height.getReadOnlyProperty(); }
 650 
 651     /**
 652      * Notification from the windowing system that the window's size has
 653      * changed.


 750     /**
 751      * Returns a previously set Object property, or null if no such property
 752      * has been set using the {@link Window#setUserData(java.lang.Object)} method.
 753      *
 754      * @return The Object that was previously set, or null if no property
 755      *          has been set or if null was set.
 756      *
 757      * @since JavaFX 8u40
 758      */
 759     public Object getUserData() {
 760         return getProperties().get(USER_DATA_KEY);
 761     }
 762 
 763     /**
 764      * The {@code Scene} to be rendered on this {@code Window}. There can only
 765      * be one {@code Scene} on the {@code Window} at a time, and a {@code Scene}
 766      * can only be on one {@code Window} at a time. Setting a {@code Scene} on
 767      * a different {@code Window} will cause the old {@code Window} to lose the
 768      * reference before the new one gains it. You may swap {@code Scene}s on
 769      * a {@code Window} at any time, even if it is an instance of {@code Stage}
 770      * and with {@link Stage#fullScreenProperty fullScreen} set to true.
 771      * If the width or height of this {@code Window} have never been set by the
 772      * application, setting the scene will cause this {@code Window} to take its
 773      * width or height from that scene.  Resizing this window by end user does
 774      * not count as setting the width or height by the application.
 775      *
 776      * An {@link IllegalStateException} is thrown if this property is set
 777      * on a thread other than the JavaFX Application Thread.
 778      *
 779      * @defaultValue null
 780      */
 781     private SceneModel scene = new SceneModel();
 782     protected void setScene(Scene value) { scene.set(value); }
 783     public final Scene getScene() { return scene.get(); }
 784     public final ReadOnlyObjectProperty<Scene> sceneProperty() { return scene.getReadOnlyProperty(); }
 785 
 786     private final class SceneModel extends ReadOnlyObjectWrapper<Scene> {
 787         private Scene oldScene;
 788 
 789         @Override protected void invalidated() {
 790             final Scene newScene = get();




 452             @Override
 453             protected void invalidated() {
 454                 updateRenderScales(getOutputScaleX(),
 455                                    getOutputScaleY());
 456             }
 457         };
 458     public final void setForceIntegerRenderScale(boolean forced) {
 459         forceIntegerRenderScale.set(forced);
 460     }
 461     public final boolean isForceIntegerRenderScale() {
 462         return forceIntegerRenderScale.get();
 463     }
 464     public final BooleanProperty forceIntegerRenderScaleProperty() {
 465         return forceIntegerRenderScale;
 466     }
 467 
 468     /**
 469      * The horizontal scale that the {@code Window} will use when rendering
 470      * its {@code Scene} to the rendering buffer.
 471      * This property is automatically updated whenever there is a change in
 472      * the {@link #outputScaleXProperty() outpitScaleX} property and can be overridden either by
 473      * calling {@code setRenderScaleX()} in response to a listener on the
 474      * {@code outputScaleX} property or by binding it appropriately.
 475      *
 476      * @defaultValue outputScaleX
 477      * @see #outputScaleXProperty()
 478      * @see #forceIntegerRenderScaleProperty()
 479      * @since 9
 480      */
 481     private DoubleProperty renderScaleX =
 482         new SimpleDoubleProperty(this, "renderScaleX", 1.0) {
 483             @Override
 484             protected void invalidated() {
 485                 peerBoundsConfigurator.setRenderScaleX(get());
 486             }
 487         };
 488     public final void setRenderScaleX(double scale) {
 489         renderScaleX.set(scale);
 490     }
 491     public final double getRenderScaleX() {
 492         return renderScaleX.get();
 493     }
 494     public final DoubleProperty renderScaleXProperty() {
 495         return renderScaleX;
 496     }
 497 
 498     /**
 499      * The vertical scale that the {@code Window} will use when rendering
 500      * its {@code Scene} to the rendering buffer.
 501      * This property is automatically updated whenever there is a change in
 502      * the {@link #outputScaleYProperty() outpitScaleY} property and can be overridden either by
 503      * calling {@code setRenderScaleY()} in response to a listener on the
 504      * {@code outputScaleY} property or by binding it appropriately.
 505      *
 506      * @defaultValue outputScaleY
 507      * @see #outputScaleYProperty()
 508      * @see #forceIntegerRenderScaleProperty()
 509      * @since 9
 510      */
 511     private DoubleProperty renderScaleY =
 512         new SimpleDoubleProperty(this, "renderScaleY", 1.0) {
 513             @Override
 514             protected void invalidated() {
 515                 peerBoundsConfigurator.setRenderScaleY(get());
 516             }
 517         };
 518     public final void setRenderScaleY(double scale) {
 519         renderScaleY.set(scale);
 520     }
 521     public final double getRenderScaleY() {
 522         return renderScaleY.get();
 523     }
 524     public final DoubleProperty renderScaleYProperty() {
 525         return renderScaleY;
 526     }
 527 
 528     private boolean xExplicit = false;
 529     /**
 530      * The horizontal location of this {@code Window} on the screen. Changing
 531      * this attribute will move the {@code Window} horizontally. If this
 532      * {@code Window} is an instance of {@code Stage}, changing this attribute
 533      * will not visually affect the {@code Window} while
 534      * {@link Stage#fullScreenProperty() fullScreen} is true, but will be honored
 535      * by the {@code Window} once {@link Stage#fullScreenProperty() fullScreen}
 536      * becomes false.
 537      */
 538     private ReadOnlyDoubleWrapper x =
 539             new ReadOnlyDoubleWrapper(this, "x", Double.NaN);
 540 
 541     public final void setX(double value) {
 542         setXInternal(value);
 543     }
 544     public final double getX() { return x.get(); }
 545     public final ReadOnlyDoubleProperty xProperty() { return x.getReadOnlyProperty(); }
 546 
 547     void setXInternal(double value) {
 548         x.set(value);
 549         peerBoundsConfigurator.setX(value, 0);
 550         xExplicit = true;
 551     }
 552 
 553     private boolean yExplicit = false;
 554     /**
 555      * The vertical location of this {@code Window} on the screen. Changing this
 556      * attribute will move the {@code Window} vertically. If this
 557      * {@code Window} is an instance of {@code Stage}, changing this attribute
 558      * will not visually affect the {@code Window} while
 559      * {@link Stage#fullScreenProperty() fullScreen} is true, but will be honored
 560      * by the {@code Window} once {@link Stage#fullScreenProperty() fullScreen}
 561      * becomes false.
 562      */
 563     private ReadOnlyDoubleWrapper y =
 564             new ReadOnlyDoubleWrapper(this, "y", Double.NaN);
 565 
 566     public final void setY(double value) {
 567         setYInternal(value);
 568     }
 569     public final double getY() { return y.get(); }
 570     public final ReadOnlyDoubleProperty yProperty() { return y.getReadOnlyProperty(); }
 571 
 572     void setYInternal(double value) {
 573         y.set(value);
 574         peerBoundsConfigurator.setY(value, 0);
 575         yExplicit = true;
 576     }
 577 
 578     /**
 579      * Notification from the windowing system that the window's position has
 580      * changed.


 582      * @param newX the new window x position
 583      * @param newY the new window y position
 584      */
 585     void notifyLocationChanged(double newX, double newY) {
 586         x.set(newX);
 587         y.set(newY);
 588     }
 589 
 590     private boolean widthExplicit = false;
 591 
 592     /**
 593      * The width of this {@code Window}. Changing this attribute will narrow or
 594      * widen the width of the {@code Window}. This value includes any and all
 595      * decorations which may be added by the Operating System such as resizable
 596      * frame handles. Typical applications will set the {@link javafx.scene.Scene}
 597      * width instead. This {@code Window} will take its width from the scene if
 598      * it has never been set by the application. Resizing the window by end user
 599      * does not count as a setting the width by the application. If this
 600      * {@code Window} is an instance of {@code Stage}, changing this attribute
 601      * will not visually affect the {@code Window} while
 602      * {@link Stage#fullScreenProperty() fullScreen} is true, but will be honored
 603      * by the {@code Window} once {@link Stage#fullScreenProperty() fullScreen}
 604      * becomes false.
 605      * <p>
 606      * The property is read only because it can be changed externally
 607      * by the underlying platform and therefore must not be bindable.
 608      * </p>
 609      */
 610     private ReadOnlyDoubleWrapper width =
 611             new ReadOnlyDoubleWrapper(this, "width", Double.NaN);
 612 
 613     public final void setWidth(double value) {
 614         width.set(value);
 615         peerBoundsConfigurator.setWindowWidth(value);
 616         widthExplicit = true;
 617     }
 618     public final double getWidth() { return width.get(); }
 619     public final ReadOnlyDoubleProperty widthProperty() { return width.getReadOnlyProperty(); }
 620 
 621     private boolean heightExplicit = false;
 622     /**
 623      * The height of this {@code Window}. Changing this attribute will shrink
 624      * or heighten the height of the {@code Window}. This value includes any and all
 625      * decorations which may be added by the Operating System such as the title
 626      * bar. Typical applications will set the {@link javafx.scene.Scene} height
 627      * instead. This window will take its height from the scene if it has never
 628      * been set by the application. Resizing this window by end user does not
 629      * count as a setting the height by the application.  If this
 630      * {@code Window} is an instance of {@code Stage}, changing this attribute
 631      * will not visually affect the {@code Window} while
 632      * {@link Stage#fullScreenProperty() fullScreen} is true, but will be honored
 633      * by the {@code Window} once {@link Stage#fullScreenProperty() fullScreen}
 634      * becomes false.
 635      * <p>
 636      * The property is read only because it can be changed externally
 637      * by the underlying platform and therefore must not be bindable.
 638      * </p>
 639      */
 640     private ReadOnlyDoubleWrapper height =
 641             new ReadOnlyDoubleWrapper(this, "height", Double.NaN);
 642 
 643     public final void setHeight(double value) {
 644         height.set(value);
 645         peerBoundsConfigurator.setWindowHeight(value);
 646         heightExplicit = true;
 647     }
 648     public final double getHeight() { return height.get(); }
 649     public final ReadOnlyDoubleProperty heightProperty() { return height.getReadOnlyProperty(); }
 650 
 651     /**
 652      * Notification from the windowing system that the window's size has
 653      * changed.


 750     /**
 751      * Returns a previously set Object property, or null if no such property
 752      * has been set using the {@link Window#setUserData(java.lang.Object)} method.
 753      *
 754      * @return The Object that was previously set, or null if no property
 755      *          has been set or if null was set.
 756      *
 757      * @since JavaFX 8u40
 758      */
 759     public Object getUserData() {
 760         return getProperties().get(USER_DATA_KEY);
 761     }
 762 
 763     /**
 764      * The {@code Scene} to be rendered on this {@code Window}. There can only
 765      * be one {@code Scene} on the {@code Window} at a time, and a {@code Scene}
 766      * can only be on one {@code Window} at a time. Setting a {@code Scene} on
 767      * a different {@code Window} will cause the old {@code Window} to lose the
 768      * reference before the new one gains it. You may swap {@code Scene}s on
 769      * a {@code Window} at any time, even if it is an instance of {@code Stage}
 770      * and with {@link Stage#fullScreenProperty() fullScreen} set to true.
 771      * If the width or height of this {@code Window} have never been set by the
 772      * application, setting the scene will cause this {@code Window} to take its
 773      * width or height from that scene.  Resizing this window by end user does
 774      * not count as setting the width or height by the application.
 775      *
 776      * An {@link IllegalStateException} is thrown if this property is set
 777      * on a thread other than the JavaFX Application Thread.
 778      *
 779      * @defaultValue null
 780      */
 781     private SceneModel scene = new SceneModel();
 782     protected void setScene(Scene value) { scene.set(value); }
 783     public final Scene getScene() { return scene.get(); }
 784     public final ReadOnlyObjectProperty<Scene> sceneProperty() { return scene.getReadOnlyProperty(); }
 785 
 786     private final class SceneModel extends ReadOnlyObjectWrapper<Scene> {
 787         private Scene oldScene;
 788 
 789         @Override protected void invalidated() {
 790             final Scene newScene = get();


< prev index next >