modules/graphics/src/main/java/javafx/scene/Scene.java

Print this page




 147 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGER;
 148 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
 149 
 150 /**
 151  * The JavaFX {@code Scene} class is the container for all content in a scene graph.
 152  * The background of the scene is filled as specified by the {@code fill} property.
 153  * <p>
 154  * The application must specify the root {@code Node} for the scene graph by setting
 155  * the {@code root} property.   If a {@code Group} is used as the root, the
 156  * contents of the scene graph will be clipped by the scene's width and height and
 157  * changes to the scene's size (if user resizes the stage) will not alter the
 158  * layout of the scene graph.    If a resizable node (layout {@code Region} or
 159  * {@code Control} is set as the root, then the root's size will track the
 160  * scene's size, causing the contents to be relayed out as necessary.
 161  * <p>
 162  * The scene's size may be initialized by the application during construction.
 163  * If no size is specified, the scene will automatically compute its initial
 164  * size based on the preferred size of its content. If only one dimension is specified,
 165  * the other dimension is computed using the specified dimension, respecting content bias
 166  * of a root.





 167  *
 168  * <p>
 169  * Scene objects must be constructed and modified on the
 170  * JavaFX Application Thread.
 171  * </p>
 172  *
 173  * <p>Example:</p>
 174  *
 175  * <p>
 176  * <pre>
 177 import javafx.scene.*;
 178 import javafx.scene.paint.*;
 179 import javafx.scene.shape.*;
 180 
 181 Group root = new Group();
 182 Scene s = new Scene(root, 300, 300, Color.BLACK);
 183 
 184 Rectangle r = new Rectangle(25,25,250,250);
 185 r.setFill(Color.BLUE);
 186 




 147 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGER;
 148 import static com.sun.javafx.logging.PulseLogger.PULSE_LOGGING_ENABLED;
 149 
 150 /**
 151  * The JavaFX {@code Scene} class is the container for all content in a scene graph.
 152  * The background of the scene is filled as specified by the {@code fill} property.
 153  * <p>
 154  * The application must specify the root {@code Node} for the scene graph by setting
 155  * the {@code root} property.   If a {@code Group} is used as the root, the
 156  * contents of the scene graph will be clipped by the scene's width and height and
 157  * changes to the scene's size (if user resizes the stage) will not alter the
 158  * layout of the scene graph.    If a resizable node (layout {@code Region} or
 159  * {@code Control} is set as the root, then the root's size will track the
 160  * scene's size, causing the contents to be relayed out as necessary.
 161  * <p>
 162  * The scene's size may be initialized by the application during construction.
 163  * If no size is specified, the scene will automatically compute its initial
 164  * size based on the preferred size of its content. If only one dimension is specified,
 165  * the other dimension is computed using the specified dimension, respecting content bias
 166  * of a root.
 167  * 
 168  * <p>
 169  * A default headlight will be added to a scene that contains {@code Shape3D}
 170  * but without light source. This light source is a {@code Color.WHITE}
 171  * {@code PointLight} placed at the camera position.
 172  *
 173  * <p>
 174  * Scene objects must be constructed and modified on the
 175  * JavaFX Application Thread.
 176  * </p>
 177  *
 178  * <p>Example:</p>
 179  *
 180  * <p>
 181  * <pre>
 182 import javafx.scene.*;
 183 import javafx.scene.paint.*;
 184 import javafx.scene.shape.*;
 185 
 186 Group root = new Group();
 187 Scene s = new Scene(root, 300, 300, Color.BLACK);
 188 
 189 Rectangle r = new Rectangle(25,25,250,250);
 190 r.setFill(Color.BLUE);
 191