diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java index 1923d4d..bef2b06 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DiskForm.java @@ -61,7 +61,7 @@ public class DiskForm { OSFileStore store = fileStores.get(i); JPanel diskPanel = new JPanel(); - diskPanel.setLayout(new GridLayoutManager(3, 1, new Insets(10, 0, 10, 0), -1, -1)); + diskPanel.setLayout(new GridLayoutManager(3, 3, new Insets(10, 0, 10, 0), -1, -1)); JLabel title = new JLabel(); StringBuilder titleBuilder = new StringBuilder(); titleBuilder.append(store.getName()); @@ -70,13 +70,13 @@ public class DiskForm { titleBuilder.append(store.getLabel()); } title.setText(titleBuilder.toString()); - Font font = new Font(diskListPanel.getFont().getName(), Font.BOLD, diskListPanel.getFont().getSize()); + Font font = new Font(diskListPanel.getFont().getName(), Font.BOLD, diskListPanel.getFont().getSize() + 2); title.setFont(font); - diskPanel.add(title, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + diskPanel.add(title, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); JProgressBar spacePercent = new JProgressBar(); - diskPanel.add(spacePercent, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + diskPanel.add(spacePercent, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); JLabel subTitle = new JLabel(); long usable = store.getUsableSpace(); long total = store.getTotalSpace(); @@ -84,9 +84,15 @@ public class DiskForm { int usagePercent = (int) ((total - usable) * 100 / total); spacePercent.setValue(usagePercent); spacePercent.setToolTipText(usagePercent + "%"); - subTitle.setText("Available: " + DataSizeUtil.format(usable) + "/" + DataSizeUtil.format(total)); + subTitle.setText("Used " + DataSizeUtil.format(total - usable) + "/" + DataSizeUtil.format(total)); diskPanel.add(subTitle, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + JLabel available = new JLabel(); + available.setText(DataSizeUtil.format(usable) + "/" + DataSizeUtil.format(total) + " Available"); + diskPanel.add(available, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + diskPanel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + diskListPanel.add(diskPanel, new GridConstraints(i, 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)); diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.form b/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.form index 38d953e..e1d3ab4 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.form +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.form @@ -29,7 +29,7 @@ - + @@ -39,7 +39,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -59,6 +59,19 @@ + + + + + + + + + + + + + diff --git a/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.java b/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.java index 7b5584d..fb8db8f 100644 --- a/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.java +++ b/src/main/java/com/luoboduner/moo/info/ui/form/DiskFormLayoutDesign.java @@ -33,6 +33,7 @@ public class DiskFormLayoutDesign { private JLabel disk3Label1; private JLabel disk3Label2; private JPanel diskListPanel; + private JLabel disk1Label3; private static final Log logger = LogFactory.get(); @@ -85,16 +86,21 @@ public class DiskFormLayoutDesign { diskListPanel.setLayout(new GridLayoutManager(4, 1, new Insets(0, 10, 0, 10), -1, -1)); scrollPane1.setViewportView(diskListPanel); disk1Panel = new JPanel(); - disk1Panel.setLayout(new GridLayoutManager(3, 1, new Insets(10, 0, 10, 0), -1, -1)); + disk1Panel.setLayout(new GridLayoutManager(3, 3, new Insets(10, 0, 10, 0), -1, -1)); diskListPanel.add(disk1Panel, 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)); disk1Label1 = new JLabel(); disk1Label1.setText("Label"); - disk1Panel.add(disk1Label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + disk1Panel.add(disk1Label1, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); disk1ProgressBar = new JProgressBar(); - disk1Panel.add(disk1ProgressBar, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + disk1Panel.add(disk1ProgressBar, new GridConstraints(1, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); disk1Label2 = new JLabel(); disk1Label2.setText("Label"); disk1Panel.add(disk1Label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + disk1Label3 = new JLabel(); + disk1Label3.setText("Label"); + disk1Panel.add(disk1Label3, new GridConstraints(2, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + disk1Panel.add(spacer1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); disk2Panel = new JPanel(); disk2Panel.setLayout(new GridLayoutManager(3, 1, new Insets(10, 0, 10, 0), -1, -1)); diskListPanel.add(disk2Panel, 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)); @@ -117,8 +123,8 @@ public class DiskFormLayoutDesign { disk3Label2 = new JLabel(); disk3Label2.setText("Label"); disk3Panel.add(disk3Label2, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); - final Spacer spacer1 = new Spacer(); - diskListPanel.add(spacer1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + diskListPanel.add(spacer2, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); } /**