From 2a45cf3ca092945f00f7ad869c01678ff85ae807 Mon Sep 17 00:00:00 2001 From: RememBerBer Date: Wed, 24 Nov 2021 22:28:43 +0800 Subject: [PATCH] power form opt --- .../com/luoboduner/moo/info/ui/form/PowerSourceForm.form | 9 ++------- .../com/luoboduner/moo/info/ui/form/PowerSourceForm.java | 7 +++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form index e76c9e3..28d833a 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.form @@ -15,17 +15,12 @@ - + - - - - - @@ -38,7 +33,7 @@ - + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java index bc262b2..29b9983 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/PowerSourceForm.java @@ -136,6 +136,7 @@ public class PowerSourceForm { StringBuilder powerInfoBuilder = new StringBuilder(); for (PowerSource powerSource : powerSources) { + powerInfoBuilder.append("
"); powerInfoBuilder.append("Name: ").append(powerSource.getName()); powerInfoBuilder.append("
Device Name: ").append(powerSource.getDeviceName()); powerInfoBuilder.append("
Remaining Capacity Percent: ").append(powerSource.getRemainingCapacityPercent() * 100).append("%"); @@ -180,16 +181,14 @@ public class PowerSourceForm { mainPanel.add(scrollPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); scrollPane.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null)); final JPanel panel1 = new JPanel(); - panel1.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1)); + panel1.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); scrollPane.setViewportView(panel1); - final Spacer spacer1 = new Spacer(); - panel1.add(spacer1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); powerBasePanel = new JPanel(); powerBasePanel.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); panel1.add(powerBasePanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); powerInfoPanel = new JPanel(); powerInfoPanel.setLayout(new GridLayoutManager(1, 1, new Insets(10, 10, 10, 10), -1, -1)); - panel1.add(powerInfoPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + panel1.add(powerInfoPanel, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); powerInfoTextPane = new JTextPane(); powerInfoTextPane.setEditable(true); powerInfoPanel.add(powerInfoTextPane, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));