set various files including 'Settings Window' and light & dark themes in CSS, rename BrickLogClient : BrickLogClientApplication

This commit is contained in:
bryce
2024-10-28 11:53:08 +13:00
parent 83eb995d69
commit 5b618916b1
28 changed files with 328 additions and 9 deletions

59
BrickLog-Client/pom.xml Normal file
View File

@@ -0,0 +1,59 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>bricklog-client</artifactId>
<version>0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<java.version>21</java.version>
<javafx.version>23.0.1</javafx.version> <!-- Use the version compatible with your setup -->
</properties>
<dependencies>
<!-- JavaFX dependencies -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- Other dependencies can be added here as needed -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.5</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.example.bricklog.BrickLogClientApplication</mainClass> <!-- Change to your main class -->
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,54 @@
package com.example.bricklog;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class BrickLogClientApplication extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Brick Log");
// Create layout
VBox layout = new VBox(10); // Vertical box with spacing of 10 pixels
// Search Box
TextField searchBox = new TextField();
searchBox.setPromptText("Search for builds...");
// Add Button
Button addButton = new Button("+");
addButton.setStyle("-fx-background-color: lightblue; -fx-font-size: 18px; -fx-padding: 10px; -fx-font-weight: bold;");
addButton.setPrefSize(50, 50);
// Animation Effect on Click
addButton.setOnMouseClicked(e -> {
addButton.setScaleX(1.2);
addButton.setScaleY(1.2);
// You may want to add logic for adding a new build here
// For example, opening a new window to add a build
});
// Reset size after animation
addButton.setOnMouseReleased(e -> {
addButton.setScaleX(1.0);
addButton.setScaleY(1.0);
});
// Add components to layout
layout.getChildren().addAll(searchBox, addButton);
// Create a scene and set it to the stage
Scene scene = new Scene(layout, 400, 300); // Set the width and height as per your need
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}

View File

@@ -0,0 +1,101 @@
package com.example.bricklog.view;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.RadioButton;
import javafx.scene.control.Slider;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class SettingsWindow extends Application {
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Settings");
// Create a TabPane for organizing settings
TabPane tabPane = new TabPane();
// Tab 1: Display Settings
Tab displayTab = new Tab("Display Settings");
displayTab.setContent(createDisplaySettingsContent());
displayTab.setClosable(false);
// Tab 2: Server Settings
Tab serverTab = new Tab("Server Settings");
serverTab.setContent(createServerSettingsContent());
serverTab.setClosable(false);
tabPane.getTabs().addAll(displayTab, serverTab);
// Set up the scene
VBox vbox = new VBox(tabPane);
Scene scene = new Scene(vbox, 400, 300);
primaryStage.setScene(scene);
primaryStage.show();
}
private GridPane createDisplaySettingsContent() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(10));
grid.setVgap(10);
grid.setHgap(10);
// Font Size Adjuster
Label fontSizeLabel = new Label("Font Size:");
Slider fontSizeSlider = new Slider(10, 30, 14);
fontSizeSlider.setShowTickLabels(true);
fontSizeSlider.setShowTickMarks(true);
// Dark/Light Mode Toggle
Label themeLabel = new Label("Theme:");
ToggleGroup themeGroup = new ToggleGroup();
RadioButton lightMode = new RadioButton("Light");
RadioButton darkMode = new RadioButton("Dark");
lightMode.setToggleGroup(themeGroup);
darkMode.setToggleGroup(themeGroup);
lightMode.setSelected(true);
grid.add(fontSizeLabel, 0, 0);
grid.add(fontSizeSlider, 1, 0);
grid.add(themeLabel, 0, 1);
grid.add(lightMode, 1, 1);
grid.add(darkMode, 2, 1);
return grid;
}
private GridPane createServerSettingsContent() {
GridPane grid = new GridPane();
grid.setPadding(new Insets(10));
grid.setVgap(10);
grid.setHgap(10);
// Server IP
Label ipLabel = new Label("Server IP:");
TextField ipField = new TextField();
// Authentication Token
Label authLabel = new Label("Auth Token:");
PasswordField authField = new PasswordField();
grid.add(ipLabel, 0, 0);
grid.add(ipField, 1, 0);
grid.add(authLabel, 0, 1);
grid.add(authField, 1, 1);
return grid;
}
public static void main(String[] args) {
launch(args);
}
}

View File

@@ -0,0 +1,3 @@
artifactId=bricklog-client
groupId=com.example
version=0.1-SNAPSHOT

View File

@@ -0,0 +1,2 @@
com\example\bricklog\BrickLogClientApplication.class
com\example\bricklog\view\SettingsWindow.class

View File

@@ -0,0 +1,3 @@
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\BrickLogClientApplication.java
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\controller\SettingsController.java
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\main\java\com\example\bricklog\view\SettingsWindow.java

View File

@@ -0,0 +1 @@
C:\Users\bryce\Documents\Git\BrickLog\BrickLog-Client\src\test\java\com\example\bricklog\BrickLogClient.java