• ... , which connects the start and end points with a straight line.

22.3.2 CSS That Styles the Two-Dimensional Shapes

Figure 22.4 shows the CSS for the BasicShapes app. In this CSS file, we define two CSS rules with ID selectors (#line1 and #line2) to style the app’s two Line objects. The remaining rules use type selectors, which apply to all objects of a given type. You specify a type selector by using the JavaFX class name.

Fig. 22.4 CSS that styles various two-dimensional shapes


 1   /* Fig. 22.4: BasicShapes.css */
 2   /* CSS that styles various two-dimensional shapes */
 3
 4   Line, Rectangle, Circle, Ellipse, Arc {
 5       -fx-stroke-width: 10;
 6   }
 7
 8   #line1 {
 9       -fx-stroke: red;
10   }
11
12   #line2 {
13       -fx-stroke: rgba(0%, 50%, 0%, 0.5);
14       -fx-stroke-line-cap ...

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.