Skip to content

Commit

Permalink
Added utility bar
Browse files Browse the repository at this point in the history
  • Loading branch information
VyaasBaskar committed Jan 11, 2025
1 parent 433af05 commit 474a09d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.funkylogclient</groupId>
<artifactId>funkylogclient</artifactId>
<version>1.0</version>
<version>1.1.4</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
43 changes: 39 additions & 4 deletions src/main/java/com/funkylogclient/FunkyLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
import javafx.concurrent.Task;
import javafx.geometry.*;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Duration;
Expand All @@ -25,6 +26,8 @@

public class FunkyLogs extends Application {

public static final String APP_NAME = "FunkyLogs v1.1.4";

private BorderPane root;

private double xl = 100;
Expand All @@ -44,11 +47,14 @@ public class FunkyLogs extends Application {
@Override
public void start(Stage primaryStage) {
FunkyLogSorter.makeNewLogFile();
primaryStage.setTitle("FunkyLogs v1.1.3");
primaryStage.setTitle(APP_NAME);

root = new BorderPane();
root.getStyleClass().add("root");


root.setTop(createUtilityBar(primaryStage));

VBox center = new VBox();
center.setStyle(Styles.CENTER);
center.setPadding(new Insets(10, 10, 10, 10));
Expand Down Expand Up @@ -231,6 +237,35 @@ private void enableResizing(Stage stage, BorderPane root) {
});
}

private HBox createUtilityBar(Stage primaryStage) {
HBox utilityBar = new HBox(10);
utilityBar.setPadding(new Insets(7, 15, 3, 10));
utilityBar.setStyle("-fx-background-color: #2E2E2E; -fx-background-radius: 10 10 0 0;");

Circle closeButton = createUtilityButton(true, () -> System.exit(0));
Circle minimizeButton = createUtilityButton(false, () -> primaryStage.setIconified(true));

Label appNameLabel = new Label(APP_NAME);
appNameLabel.setStyle("-fx-text-fill: white; -fx-font-size: 14px;");

Region spacer = new Region();
HBox.setHgrow(spacer, Priority.ALWAYS);

utilityBar.getChildren().addAll(appNameLabel, spacer, minimizeButton, closeButton);

return utilityBar;
}


private Circle createUtilityButton(boolean isCloseButton, Runnable action) {
Color color = isCloseButton ? Color.RED : Color.YELLOW;
Circle button = new Circle(6, color);
button.setOnMouseEntered(e -> button.setOpacity(0.8));
button.setOnMouseExited(e -> button.setOpacity(1.0));
button.setOnMouseClicked(e -> action.run());
return button;
}

public static void main(String[] args) {
launch(args);
}
Expand Down
Binary file modified target/classes/com/funkylogclient/FunkyLogs$1.class
Binary file not shown.
Binary file modified target/classes/com/funkylogclient/FunkyLogs.class
Binary file not shown.
Binary file modified target/classes/com/funkylogclient/SidebarTopSection.class
Binary file not shown.

0 comments on commit 474a09d

Please sign in to comment.