Skip to content

Commit 474a09d

Browse files
committed
Added utility bar
1 parent 433af05 commit 474a09d

5 files changed

Lines changed: 40 additions & 5 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.funkylogclient</groupId>
55
<artifactId>funkylogclient</artifactId>
6-
<version>1.0</version>
6+
<version>1.1.4</version>
77
<properties>
88
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
99
<maven.compiler.source>17</maven.compiler.source>

src/main/java/com/funkylogclient/FunkyLogs.java

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
import javafx.concurrent.Task;
1010
import javafx.geometry.*;
1111
import javafx.scene.Scene;
12-
import javafx.scene.control.Alert;
12+
import javafx.scene.control.*;
1313
import javafx.scene.control.Alert.AlertType;
14-
import javafx.scene.control.ScrollPane;
15-
import javafx.scene.control.TextField;
1614
import javafx.scene.layout.BorderPane;
1715
import javafx.scene.layout.HBox;
16+
import javafx.scene.layout.Priority;
17+
import javafx.scene.layout.Region;
1818
import javafx.scene.layout.VBox;
1919
import javafx.scene.paint.Color;
20+
import javafx.scene.shape.Circle;
2021
import javafx.stage.Stage;
2122
import javafx.stage.StageStyle;
2223
import javafx.util.Duration;
@@ -25,6 +26,8 @@
2526

2627
public 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 Bytes
Binary file not shown.
2.51 KB
Binary file not shown.
-74 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)