|
8 | 8 | import javafx.animation.AnimationTimer; |
9 | 9 | import javafx.application.Application; |
10 | 10 | import javafx.geometry.Insets; |
11 | | -import javafx.geometry.Pos; |
12 | 11 | import javafx.scene.Node; |
13 | 12 | import javafx.scene.Scene; |
14 | 13 | import javafx.scene.canvas.Canvas; |
|
26 | 25 | import javafx.scene.control.ToggleGroup; |
27 | 26 | import javafx.scene.layout.BorderPane; |
28 | 27 | import javafx.scene.layout.HBox; |
29 | | -import javafx.scene.control.ScrollPane; |
30 | | -import javafx.scene.control.SplitPane; |
31 | 28 | import javafx.scene.layout.StackPane; |
32 | 29 | import javafx.scene.layout.VBox; |
33 | 30 | import javafx.scene.paint.Color; |
@@ -57,9 +54,8 @@ public class Main extends Application { |
57 | 54 | TextField algFilter; |
58 | 55 | Label status; |
59 | 56 | BorderPane root; |
60 | | - VBox right; |
61 | | - ScrollPane rightScroll; |
62 | 57 | MenuBar menuBar; |
| 58 | + HBox controlBar; |
63 | 59 | ChoiceBox<ThemeOption> themeChoice; |
64 | 60 | ChoiceBox<Accent> accentChoice; |
65 | 61 | ChoiceBox<String> fontChoice; |
@@ -125,17 +121,13 @@ public void start(Stage stage) { |
125 | 121 | barModeChoice.getItems().addAll(BarMode.RAINBOW, BarMode.ACCENT, BarMode.CUSTOM); |
126 | 122 | barModeChoice.getSelectionModel().selectFirst(); |
127 | 123 |
|
| 124 | + controlBar = buildControlBar(shuffle, run); |
128 | 125 | root = new BorderPane(); |
129 | 126 | menuBar = buildMenu(stage); |
130 | | - root.setTop(menuBar); |
| 127 | + VBox header = new VBox(menuBar, controlBar); |
| 128 | + root.setTop(header); |
131 | 129 | StackPane center = new StackPane(canvas); |
132 | | - right = buildRightPanel(shuffle, run); |
133 | | - rightScroll = new ScrollPane(right); |
134 | | - rightScroll.setFitToWidth(true); |
135 | | - rightScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); |
136 | | - SplitPane split = new SplitPane(center, rightScroll); |
137 | | - split.setDividerPositions(0.75); |
138 | | - root.setCenter(split); |
| 130 | + root.setCenter(center); |
139 | 131 | Scene scene = new Scene(root, 1100, 600); |
140 | 132 |
|
141 | 133 | canvas.widthProperty().bind(center.widthProperty()); |
@@ -262,9 +254,8 @@ void applyTheme() { |
262 | 254 | String acc = toHex(accent.color()); |
263 | 255 | root.setStyle("-fx-background-color:" + bg + "; -fx-base:" + panel + "; -fx-control-inner-background:" + panel + "; -fx-text-fill:" + text + "; -fx-accent:" + acc + "; -fx-focus-color:" + acc + "; -fx-faint-focus-color:" + acc + "33; -fx-font-family: " + fontFamily + "; -fx-font-size: 12px;"); |
264 | 256 | menuBar.setStyle("-fx-background-color:" + panel + "; -fx-text-fill:" + text + ";"); |
265 | | - right.setStyle("-fx-background-color:" + panel + "; -fx-border-color:" + acc + "; -fx-border-width:1;"); |
266 | | - rightScroll.setStyle("-fx-background:" + panel + "; -fx-background-color:" + panel + ";"); |
267 | | - for (Node n : right.getChildren()) { |
| 257 | + controlBar.setStyle("-fx-background-color:" + panel + "; -fx-border-color:" + acc + "; -fx-border-width:0 0 1 0;"); |
| 258 | + for (Node n : controlBar.getChildren()) { |
268 | 259 | if (n instanceof Label l) l.setTextFill(theme.text()); |
269 | 260 | } |
270 | 261 | for (Node n : menuBar.getChildrenUnmodifiable()) { |
@@ -480,19 +471,15 @@ void openAbout(Stage owner) { |
480 | 471 | s.showAndWait(); |
481 | 472 | } |
482 | 473 |
|
483 | | - VBox buildRightPanel(Button shuffle, Button run) { |
484 | | - VBox box = new VBox(8, |
485 | | - label("Controls"), |
| 474 | + HBox buildControlBar(Button shuffle, Button run) { |
| 475 | + HBox box = new HBox(10, |
486 | 476 | label("Algorithm"), algFilter, alg, |
487 | 477 | label("Size"), size, sizeField, |
488 | 478 | label("Speed"), speed, speedField, |
489 | 479 | shuffle, run, |
490 | 480 | label("Status"), status |
491 | 481 | ); |
492 | | - box.setPadding(new Insets(12)); |
493 | | - box.setPrefWidth(260); |
494 | | - box.setMinWidth(220); |
495 | | - box.setAlignment(Pos.TOP_LEFT); |
| 482 | + box.setPadding(new Insets(6, 8, 6, 8)); |
496 | 483 | return box; |
497 | 484 | } |
498 | 485 |
|
|
0 commit comments