disk and power form opt
This commit is contained in:
parent
06a2ffb31b
commit
33b22d9056
|
@ -17,6 +17,9 @@ import javax.swing.*;
|
|||
import javax.swing.border.TitledBorder;
|
||||
import java.awt.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* DiskForm
|
||||
|
@ -44,7 +47,9 @@ public class DiskForm {
|
|||
diskForm = getInstance();
|
||||
|
||||
initUi();
|
||||
initInfo();
|
||||
|
||||
ScheduledExecutorService serviceStartPerSecond = Executors.newSingleThreadScheduledExecutor();
|
||||
serviceStartPerSecond.scheduleAtFixedRate(DiskForm::initInfo, 0, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private static void initUi() {
|
||||
|
@ -55,6 +60,8 @@ public class DiskForm {
|
|||
List<OSFileStore> fileStores = fileSystem.getFileStores();
|
||||
JPanel diskListPanel = getInstance().getDiskListPanel();
|
||||
|
||||
diskListPanel.removeAll();
|
||||
|
||||
diskListPanel.setLayout(new GridLayoutManager(fileStores.size() + 1, 1, new Insets(0, 10, 0, 10), -1, -1));
|
||||
|
||||
for (int i = 0; i < fileStores.size(); i++) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PowerSourceForm {
|
|||
|
||||
initUi();
|
||||
ScheduledExecutorService serviceStartPerSecond = Executors.newSingleThreadScheduledExecutor();
|
||||
serviceStartPerSecond.scheduleAtFixedRate(PowerSourceForm::initInfo, 0, 30, TimeUnit.SECONDS);
|
||||
serviceStartPerSecond.scheduleAtFixedRate(PowerSourceForm::initInfo, 0, 10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private static void initUi() {
|
||||
|
@ -59,6 +59,8 @@ public class PowerSourceForm {
|
|||
PowerSourceForm powerSourceForm = getInstance();
|
||||
JPanel powerBasePanel = powerSourceForm.getPowerBasePanel();
|
||||
|
||||
powerBasePanel.removeAll();
|
||||
|
||||
powerBasePanel.setLayout(new GridLayoutManager(powerSources.size(), 1, new Insets(0, 0, 0, 0), -1, -1));
|
||||
|
||||
StringBuilder powerSourceInfoTextBuilder = new StringBuilder();
|
||||
|
|
Loading…
Reference in New Issue