Java Reference
In-Depth Information
eXaMINING the BehaVIOr OF the ONtheSCeNe prOGraM
When the Onthescene program starts, its appearance should be similar to the screenshot in figure 2-6 . to fully
examine its behavior, perform the following steps. note that the property and method names on the Ui correspond to the
property and methods in the Scene , Stage , and Cursor classes, as well as Cascading style sheets (Css) file names.
1.
Drag the application around, noticing that although the Stage x and y values are relative to
the screen, the Scene 's x and y values are relative to the upper-left corner of the exterior of the
Stage (including decorations). similarly, the width and height of the Scene are the dimensions
of the interior of the Stage (which doesn't include decorations). as noted earlier, it is best to set
the Scene width and height explicitly (or let them be set implicitly by assuming the size of the
contained nodes), rather than setting the width and height of a decorated Stage .
2.
resize the program's window and observe that the width and height values change to reflect
the width and height of the Scene . also notice that the position of much of the content in the
scene changes as you change the height of the window.
3.
Click the lookup( ) hyperlink and notice that the string “scene height: XXX.X” prints in the
console, where XXX.X is the Scene 's height.
4.
hover the mouse over the choice box drop-down list and notice that it becomes slightly larger.
Click the choice box and choose a cursor style in the list, noticing that the cursor changes to
that style. Be careful about choosing nOne, as the cursor might disappear, and you'll need to
use the keyboard (or psychic powers while moving the mouse) to make it visible.
5.
Drag the slider on the left, noticing that the fill color of the Scene changes and that the string at
the top of the Scene reflects the red-green-blue (rgB) and opacity values of the current fill color.
6.
notice the appearance and content of the text on the Scene . then click changeOfscene.css,
noticing that the color and font and content characteristics for some of the text on the Scene
changes as shown in the screenshot in figure 2-7 .
Figure 2-7. The OnTheScene program with the changeOfScene CSS style sheet applied
7.
Click Onthescene.css, noticing that the color and font characteristics return to their
previous state.
Now that you've explored this example program that demonstrates features of the Scene , let's walk through the code!
 
Search WWH ::




Custom Search