|
28 | 28 | import javafx.geometry.Pos; |
29 | 29 | import javafx.scene.Scene; |
30 | 30 | import javafx.scene.control.Slider; |
| 31 | +import javafx.scene.layout.Background; |
| 32 | +import javafx.scene.layout.BackgroundFill; |
| 33 | +import javafx.scene.layout.CornerRadii; |
31 | 34 | import javafx.scene.layout.StackPane; |
| 35 | +import javafx.scene.layout.VBox; |
| 36 | +import javafx.scene.paint.Paint; |
32 | 37 | import javafx.stage.Stage; |
33 | 38 | import javafx.util.Duration; |
34 | 39 |
|
@@ -80,6 +85,7 @@ public void start(Stage stage) { |
80 | 85 | // create stack pane and JavaFX app scene |
81 | 86 | StackPane stackPane = new StackPane(); |
82 | 87 | Scene fxScene = new Scene(stackPane); |
| 88 | + fxScene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm()); |
83 | 89 |
|
84 | 90 | // set title, size, and add JavaFX scene to stage |
85 | 91 | stage.setTitle("Line of Sight GeoElement Sample"); |
@@ -129,15 +135,24 @@ public void start(Stage stage) { |
129 | 135 | heightSlider.setMaxSize(30, 150); |
130 | 136 | heightSlider.setShowTickLabels(true); |
131 | 137 | heightSlider.setOrientation(Orientation.VERTICAL); |
132 | | - stackPane.getChildren().add(heightSlider); |
133 | | - StackPane.setAlignment(heightSlider, Pos.TOP_LEFT); |
134 | | - StackPane.setMargin(heightSlider, new Insets(10, 0, 0, 10)); |
135 | 138 | heightSlider.valueProperty().addListener(e -> { |
136 | 139 | PointBuilder pointBuilder = new PointBuilder((Point) observer.getGeometry()); |
137 | 140 | pointBuilder.setZ(heightSlider.getValue()); |
138 | 141 | observer.setGeometry(pointBuilder.toGeometry()); |
139 | 142 | }); |
140 | 143 |
|
| 144 | + // show a background behind the slider |
| 145 | + VBox controlsVBox = new VBox(6); |
| 146 | + controlsVBox.setBackground(new Background(new BackgroundFill(Paint.valueOf("rgba(0,0,0,0.3)"), CornerRadii.EMPTY, |
| 147 | + Insets.EMPTY))); |
| 148 | + controlsVBox.setPadding(new Insets(10.0)); |
| 149 | + controlsVBox.setMaxSize(50, 160); |
| 150 | + controlsVBox.getStyleClass().add("panel-region"); |
| 151 | + controlsVBox.getChildren().add(heightSlider); |
| 152 | + stackPane.getChildren().add(controlsVBox); |
| 153 | + StackPane.setAlignment(controlsVBox, Pos.TOP_LEFT); |
| 154 | + StackPane.setMargin(controlsVBox, new Insets(10, 0, 0, 10)); |
| 155 | + |
141 | 156 | // create waypoints around a block for the taxi to drive to |
142 | 157 | waypoints = Arrays.asList( |
143 | 158 | new Point(-73.984513, 40.748469, SpatialReferences.getWgs84()), |
|
0 commit comments