99import javafx .concurrent .Task ;
1010import javafx .geometry .*;
1111import javafx .scene .Scene ;
12- import javafx .scene .control .Alert ;
12+ import javafx .scene .control .* ;
1313import javafx .scene .control .Alert .AlertType ;
14- import javafx .scene .control .ScrollPane ;
15- import javafx .scene .control .TextField ;
1614import javafx .scene .layout .BorderPane ;
1715import javafx .scene .layout .HBox ;
16+ import javafx .scene .layout .Priority ;
17+ import javafx .scene .layout .Region ;
1818import javafx .scene .layout .VBox ;
1919import javafx .scene .paint .Color ;
20+ import javafx .scene .shape .Circle ;
2021import javafx .stage .Stage ;
2122import javafx .stage .StageStyle ;
2223import javafx .util .Duration ;
2526
2627public class FunkyLogs extends Application {
2728
29+ public static final String APP_NAME = "FunkyLogs v1.1.4" ;
30+
2831 private BorderPane root ;
2932
3033 private double xl = 100 ;
@@ -44,11 +47,14 @@ public class FunkyLogs extends Application {
4447 @ Override
4548 public void start (Stage primaryStage ) {
4649 FunkyLogSorter .makeNewLogFile ();
47- primaryStage .setTitle ("FunkyLogs v1.1.3" );
50+ primaryStage .setTitle (APP_NAME );
4851
4952 root = new BorderPane ();
5053 root .getStyleClass ().add ("root" );
5154
55+
56+ root .setTop (createUtilityBar (primaryStage ));
57+
5258 VBox center = new VBox ();
5359 center .setStyle (Styles .CENTER );
5460 center .setPadding (new Insets (10 , 10 , 10 , 10 ));
@@ -231,6 +237,35 @@ private void enableResizing(Stage stage, BorderPane root) {
231237 });
232238 }
233239
240+ private HBox createUtilityBar (Stage primaryStage ) {
241+ HBox utilityBar = new HBox (10 );
242+ utilityBar .setPadding (new Insets (7 , 15 , 3 , 10 ));
243+ utilityBar .setStyle ("-fx-background-color: #2E2E2E; -fx-background-radius: 10 10 0 0;" );
244+
245+ Circle closeButton = createUtilityButton (true , () -> System .exit (0 ));
246+ Circle minimizeButton = createUtilityButton (false , () -> primaryStage .setIconified (true ));
247+
248+ Label appNameLabel = new Label (APP_NAME );
249+ appNameLabel .setStyle ("-fx-text-fill: white; -fx-font-size: 14px;" );
250+
251+ Region spacer = new Region ();
252+ HBox .setHgrow (spacer , Priority .ALWAYS );
253+
254+ utilityBar .getChildren ().addAll (appNameLabel , spacer , minimizeButton , closeButton );
255+
256+ return utilityBar ;
257+ }
258+
259+
260+ private Circle createUtilityButton (boolean isCloseButton , Runnable action ) {
261+ Color color = isCloseButton ? Color .RED : Color .YELLOW ;
262+ Circle button = new Circle (6 , color );
263+ button .setOnMouseEntered (e -> button .setOpacity (0.8 ));
264+ button .setOnMouseExited (e -> button .setOpacity (1.0 ));
265+ button .setOnMouseClicked (e -> action .run ());
266+ return button ;
267+ }
268+
234269 public static void main (String [] args ) {
235270 launch (args );
236271 }
0 commit comments