Added some styles to the overview page; added more information to the overview page
This commit is contained in:
parent
6a6c109c81
commit
108ce0a801
5
pom.xml
5
pom.xml
@ -25,6 +25,11 @@
|
|||||||
<artifactId>oshi-core</artifactId>
|
<artifactId>oshi-core</artifactId>
|
||||||
<version>6.4.0</version>
|
<version>6.4.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-math3</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -31,7 +31,7 @@ public class App extends Application {
|
|||||||
System.out.println(String.valueOf(os));
|
System.out.println(String.valueOf(os));
|
||||||
|
|
||||||
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("views/home.fxml"));
|
Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("views/home.fxml"));
|
||||||
var scene = new Scene(root, 640, 480);
|
var scene = new Scene(root, 800, 600);
|
||||||
stage.setTitle("Arrow System Monitor");
|
stage.setTitle("Arrow System Monitor");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
|
@ -5,9 +5,15 @@ public class SysInfo {
|
|||||||
public static String osString = "N/a";
|
public static String osString = "N/a";
|
||||||
|
|
||||||
public static double cpuTemp = 0.0;
|
public static double cpuTemp = 0.0;
|
||||||
|
public static double cpuUsage = 0.0;
|
||||||
public static long cpuFreq = 0;
|
public static long cpuFreq = 0;
|
||||||
public static long cpuMaxFreq = 0;
|
public static long cpuMaxFreq = 0;
|
||||||
|
|
||||||
|
public static long memoryUsed = 0;
|
||||||
|
public static long memoryTotal = 0;
|
||||||
|
|
||||||
|
public static String gpuName = "N/a";
|
||||||
|
|
||||||
public static String javaVersion() {
|
public static String javaVersion() {
|
||||||
return System.getProperty("java.version");
|
return System.getProperty("java.version");
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package net.metaunix.controllers;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
|
import org.apache.commons.math3.util.Precision;
|
||||||
|
|
||||||
import net.metaunix.SysInfo;
|
import net.metaunix.SysInfo;
|
||||||
import net.metaunix.services.UpdateSystemInfoService;
|
import net.metaunix.services.UpdateSystemInfoService;
|
||||||
@ -13,8 +13,14 @@ public class HomeController {
|
|||||||
@FXML
|
@FXML
|
||||||
private Label osInfo;
|
private Label osInfo;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Label overCpuUsage;
|
||||||
|
@FXML
|
||||||
private Label overCpuTemp;
|
private Label overCpuTemp;
|
||||||
@FXML
|
@FXML
|
||||||
|
private Label overMemoryUsage;
|
||||||
|
@FXML
|
||||||
|
private Label overGpuTemp;
|
||||||
|
@FXML
|
||||||
private Label cpuCpuTemp;
|
private Label cpuCpuTemp;
|
||||||
@FXML
|
@FXML
|
||||||
private Label cpuCpuFreq;
|
private Label cpuCpuFreq;
|
||||||
@ -33,7 +39,15 @@ public class HomeController {
|
|||||||
|
|
||||||
private void updateLabels() {
|
private void updateLabels() {
|
||||||
osInfo.setText(SysInfo.osString);
|
osInfo.setText(SysInfo.osString);
|
||||||
|
overCpuUsage.setText(String.valueOf(Precision.round(SysInfo.cpuUsage * 100, 1)) + "%");
|
||||||
overCpuTemp.setText(String.valueOf(SysInfo.cpuTemp));
|
overCpuTemp.setText(String.valueOf(SysInfo.cpuTemp));
|
||||||
|
overMemoryUsage.setText(
|
||||||
|
String.valueOf(Precision.round((double) SysInfo.memoryUsed / (1024*1024*1024), 2)) +
|
||||||
|
"GB / " +
|
||||||
|
String.valueOf(Precision.round((double) SysInfo.memoryTotal / (1024*1024*1024), 2)) +
|
||||||
|
"GB"
|
||||||
|
);
|
||||||
|
overGpuTemp.setText(String.valueOf(SysInfo.gpuName));
|
||||||
cpuCpuTemp.setText(String.valueOf(SysInfo.cpuTemp));
|
cpuCpuTemp.setText(String.valueOf(SysInfo.cpuTemp));
|
||||||
cpuCpuFreq.setText(String.valueOf(SysInfo.cpuFreq));
|
cpuCpuFreq.setText(String.valueOf(SysInfo.cpuFreq));
|
||||||
cpuCpuMaxFreq.setText(String.valueOf(SysInfo.cpuMaxFreq));
|
cpuCpuMaxFreq.setText(String.valueOf(SysInfo.cpuMaxFreq));
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package net.metaunix.services;
|
package net.metaunix.services;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import javafx.concurrent.ScheduledService;
|
import javafx.concurrent.ScheduledService;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
import oshi.SystemInfo;
|
import oshi.SystemInfo;
|
||||||
import oshi.hardware.CentralProcessor;
|
import oshi.hardware.CentralProcessor;
|
||||||
|
import oshi.hardware.GlobalMemory;
|
||||||
|
import oshi.hardware.GraphicsCard;
|
||||||
import oshi.hardware.HardwareAbstractionLayer;
|
import oshi.hardware.HardwareAbstractionLayer;
|
||||||
import oshi.hardware.Sensors;
|
import oshi.hardware.Sensors;
|
||||||
import oshi.software.os.OperatingSystem;
|
import oshi.software.os.OperatingSystem;
|
||||||
@ -32,6 +35,14 @@ public class UpdateSystemInfoService extends ScheduledService<Void> {
|
|||||||
SysInfo.cpuTemp = sensors.getCpuTemperature();
|
SysInfo.cpuTemp = sensors.getCpuTemperature();
|
||||||
CentralProcessor cpu = hal.getProcessor();
|
CentralProcessor cpu = hal.getProcessor();
|
||||||
SysInfo.cpuMaxFreq = cpu.getMaxFreq();
|
SysInfo.cpuMaxFreq = cpu.getMaxFreq();
|
||||||
|
SysInfo.cpuUsage = (cpu.getSystemLoadAverage(3)[0] / cpu.getLogicalProcessorCount());
|
||||||
|
|
||||||
|
GlobalMemory memory = hal.getMemory();
|
||||||
|
SysInfo.memoryTotal = memory.getTotal();
|
||||||
|
SysInfo.memoryUsed = (SysInfo.memoryTotal - memory.getAvailable());
|
||||||
|
|
||||||
|
List<GraphicsCard> gpus = hal.getGraphicsCards();
|
||||||
|
SysInfo.gpuName = gpus.get(0).getName();
|
||||||
|
|
||||||
long[] freqs = cpu.getCurrentFreq();
|
long[] freqs = cpu.getCurrentFreq();
|
||||||
Arrays.sort(freqs);
|
Arrays.sort(freqs);
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
GridPane{
|
||||||
|
-fx-background-color: #212121;
|
||||||
|
-fx-vgap: 1;
|
||||||
|
-fx-hgap: 1;
|
||||||
|
}
|
||||||
|
GridPane AnchorPane{
|
||||||
|
-fx-background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overview-value{
|
||||||
|
-fx-font-size: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
.info-box{
|
.info-box{
|
||||||
-fx-padding: 10;
|
-fx-padding: 10;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<?import javafx.geometry.Insets?>
|
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
<?import javafx.scene.control.Menu?>
|
<?import javafx.scene.control.Menu?>
|
||||||
<?import javafx.scene.control.MenuBar?>
|
<?import javafx.scene.control.MenuBar?>
|
||||||
@ -41,6 +40,10 @@
|
|||||||
<?import javafx.scene.control.Tab?>
|
<?import javafx.scene.control.Tab?>
|
||||||
<?import javafx.scene.control.TabPane?>
|
<?import javafx.scene.control.TabPane?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
|
<?import javafx.scene.layout.ColumnConstraints?>
|
||||||
|
<?import javafx.scene.layout.GridPane?>
|
||||||
|
<?import javafx.scene.layout.RowConstraints?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
<VBox prefHeight="400.0" prefWidth="640.0" stylesheets="@../stylesheets/home.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.metaunix.controllers.HomeController">
|
<VBox prefHeight="400.0" prefWidth="640.0" stylesheets="@../stylesheets/home.css" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.metaunix.controllers.HomeController">
|
||||||
@ -92,15 +95,66 @@
|
|||||||
<content>
|
<content>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||||
<children>
|
<children>
|
||||||
<VBox prefHeight="200.0" prefWidth="100.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<GridPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
|
</rowConstraints>
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="osInfo" styleClass="info-box" text="OS Info" />
|
<AnchorPane prefHeight="200.0" prefWidth="200.0">
|
||||||
<Label fx:id="overCpuTemp" styleClass="info-box" text="Cpu Temp" />
|
<children>
|
||||||
|
<BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<bottom>
|
||||||
|
<Label text="CPU Usage" BorderPane.alignment="CENTER" />
|
||||||
|
</bottom>
|
||||||
|
<center>
|
||||||
|
<Label fx:id="overCpuUsage" styleClass="overview-value" text="N/a" BorderPane.alignment="CENTER" />
|
||||||
|
</center>
|
||||||
|
</BorderPane>
|
||||||
</children>
|
</children>
|
||||||
<padding>
|
</AnchorPane>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<AnchorPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
</padding>
|
<children>
|
||||||
</VBox>
|
<BorderPane prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<center>
|
||||||
|
<Label fx:id="overCpuTemp" styleClass="overview-value" text="N/a" BorderPane.alignment="CENTER" />
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<Label styleClass="overview-label" text="CPU Temp" BorderPane.alignment="CENTER" />
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
<AnchorPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
|
||||||
|
<children>
|
||||||
|
<BorderPane layoutX="-97.0" layoutY="-29.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<bottom>
|
||||||
|
<Label text="Memory Usage" BorderPane.alignment="CENTER" />
|
||||||
|
</bottom>
|
||||||
|
<center>
|
||||||
|
<Label fx:id="overMemoryUsage" styleClass="overview-value" text="N/a" BorderPane.alignment="CENTER" />
|
||||||
|
</center>
|
||||||
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
<AnchorPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
|
||||||
|
<children>
|
||||||
|
<BorderPane layoutX="77.0" layoutY="-26.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
|
<center>
|
||||||
|
<Label fx:id="overGpuTemp" styleClass="overview-value" text="N/a" BorderPane.alignment="CENTER" />
|
||||||
|
</center>
|
||||||
|
<bottom>
|
||||||
|
<Label styleClass="overview-label" text="GPU Name" BorderPane.alignment="CENTER" />
|
||||||
|
</bottom>
|
||||||
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
</children>
|
||||||
|
</GridPane>
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
@ -128,7 +182,11 @@
|
|||||||
</Tab>
|
</Tab>
|
||||||
<Tab text="OS">
|
<Tab text="OS">
|
||||||
<content>
|
<content>
|
||||||
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" />
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0">
|
||||||
|
<children>
|
||||||
|
<Label fx:id="osInfo" styleClass="info-box" text="OS Info" />
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
</content>
|
</content>
|
||||||
</Tab>
|
</Tab>
|
||||||
</tabs>
|
</tabs>
|
||||||
|
Loading…
Reference in New Issue
Block a user