Skip to content

Commit 29e928f

Browse files
committed
- add orange button on InformationUI
- add TooltipUI
1 parent 528a25c commit 29e928f

File tree

4 files changed

+91
-8
lines changed

4 files changed

+91
-8
lines changed

src/main/java/com/example/compactjv/Controller.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ private void setupUI() {
8181
new DiskInformationUI();
8282
new CPUInformationUI();
8383
new MemoryInformationUI();
84+
new TooltipUI();
8485
}
8586
}

src/main/java/com/example/compactjv/Disk.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.example.compactjv;
22

3+
import lombok.AllArgsConstructor;
34
import lombok.Getter;
45
import lombok.Setter;
5-
import lombok.AllArgsConstructor;
66

77
import java.util.ArrayList;
88
import java.util.Arrays;
@@ -16,11 +16,6 @@ public class Disk {
1616
private Size freeSpace;
1717
private char label;
1818

19-
public static int countDisks() {
20-
String output = CommandRunner.runCommand("wmic logicaldisk get name", true);
21-
return Objects.requireNonNull(output).split("\n").length - 1;
22-
}
23-
2419
public static Disk[] getDisks() {
2520
String output = CommandRunner.runCommand("wmic logicaldisk get name,size,freespace", true);
2621
String[] lines = Objects.requireNonNull(output).split("\n");

src/main/java/com/example/compactjv/UI/ButtonUI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private void setupInformationButton() {
8383
primaryStage.getScene().getRoot().setEffect(null);
8484
primaryStage.getScene().getRoot().setDisable(false);
8585
});
86-
86+
okButton.setStyle("-fx-background-color: #F56E0FFF; -fx-background-radius: 10; -fx-text-fill: #121212FF;");
8787
javafx.scene.control.Button githubButton = new javafx.scene.control.Button("GitHub");
8888
githubButton.setOnAction(e -> {
8989

@@ -94,7 +94,7 @@ private void setupInformationButton() {
9494
ex.printStackTrace();
9595
}
9696
});
97-
97+
githubButton.setStyle("-fx-background-color: #F56E0FFF; -fx-background-radius: 10; -fx-text-fill: #121212FF;");
9898
content.add(header, 0, 0, 2, 1);
9999
content.add(version, 0, 1, 2, 1);
100100
content.add(logoImageView, 0, 2, 2, 1);
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
package com.example.compactjv.UI;
2+
3+
import com.example.compactjv.Controller;
4+
import javafx.scene.Node;
5+
import javafx.scene.control.Tooltip;
6+
import javafx.util.Duration;
7+
8+
public class TooltipUI extends Controller {
9+
public TooltipUI() {
10+
super();
11+
setupTooltips();
12+
}
13+
14+
private void setupTooltips() {
15+
Tooltip closeButtonTooltip = createTooltip("Close the application");
16+
Tooltip.install(closeButton, closeButtonTooltip);
17+
18+
Tooltip minimizeButtonTooltip = createTooltip("Minimize the application");
19+
Tooltip.install(minimizeButton, minimizeButtonTooltip);
20+
21+
Tooltip compressButtonTooltip = createTooltip("Compress the file");
22+
Tooltip.install(compressButton, compressButtonTooltip);
23+
24+
Tooltip decompressButtonTooltip = createTooltip("Decompress the file");
25+
Tooltip.install(decompressButton, decompressButtonTooltip);
26+
27+
Tooltip informationButtonTooltip = createTooltip("Get information about the file");
28+
Tooltip.install(informationButton, informationButtonTooltip);
29+
30+
Tooltip filePathFieldTooltip = createTooltip("Enter the path of the file");
31+
Tooltip.install(filePathField, filePathFieldTooltip);
32+
33+
Tooltip currentSizeLabelTooltip = createTooltip("Displays the current size of the file");
34+
Tooltip.install(currentSizeLabel, currentSizeLabelTooltip);
35+
36+
Tooltip sizeOnDiskLabelTooltip = createTooltip("Displays the size of the file on disk");
37+
Tooltip.install(sizeOnDiskLabel, sizeOnDiskLabelTooltip);
38+
39+
Tooltip percentageLabelTooltip = createTooltip("Displays the percentage of compression/decompression");
40+
Tooltip.install(percentageLabel, percentageLabelTooltip);
41+
42+
Tooltip cpuUsageLabelTooltip = createTooltip("Displays the current CPU usage");
43+
Tooltip.install(cpuUsageLabel, cpuUsageLabelTooltip);
44+
45+
Tooltip memoryUsageLabelTooltip = createTooltip("Displays the current memory usage");
46+
Tooltip.install(memoryUsageLabel, memoryUsageLabelTooltip);
47+
48+
Tooltip totalFolderOnFileTooltip = createTooltip("Displays the total number of folders in the file");
49+
Tooltip.install(totalFolderOnFile, totalFolderOnFileTooltip);
50+
51+
Tooltip compressionAlgorithmChoiceBoxTooltip = createTooltip("Select the compression algorithm");
52+
Tooltip.install(compressionAlgorithmChoiceBox, compressionAlgorithmChoiceBoxTooltip);
53+
54+
Tooltip progressBarTooltip = createTooltip("Displays the progress of compression/decompression");
55+
Tooltip.install(progressBar, progressBarTooltip);
56+
57+
Tooltip infoTextTooltip = createTooltip("Displays information about the application");
58+
Tooltip.install(infoText, infoTextTooltip);
59+
60+
Tooltip homeTextTooltip = createTooltip("Navigate to the home screen");
61+
Tooltip.install(homeText, homeTextTooltip);
62+
63+
Tooltip hamburgerButtonTooltip = createTooltip("Open the navigation menu");
64+
Tooltip.install(hamburgerButton, hamburgerButtonTooltip);
65+
66+
Tooltip diskContainerTooltip = createTooltip("Displays information about the disk");
67+
Tooltip.install(diskContainer, diskContainerTooltip);
68+
69+
Tooltip debugTextAreaTooltip = createTooltip("Displays debug information");
70+
Tooltip.install(debugTextArea, debugTextAreaTooltip);
71+
}
72+
73+
private Tooltip createTooltip(String text) {
74+
Tooltip tooltip = new Tooltip(text);
75+
tooltip.setShowDelay(Duration.seconds(0.5));
76+
tooltip.setStyle("-fx-font-family: 'Segoe UI'; -fx-font-size: 14; -fx-background-color: #FFFFFF; -fx-text-fill: #000000;");
77+
78+
Node scene = tooltip.getScene().getRoot();
79+
scene.setOnMouseMoved(event -> {
80+
tooltip.setX(event.getScreenX());
81+
tooltip.setY(event.getScreenY());
82+
});
83+
84+
return tooltip;
85+
}
86+
87+
}

0 commit comments

Comments
 (0)