|
@@ -35,7 +35,9 @@ import java.util.Arrays;
|
35
|
35
|
|
36
|
36
|
import javax.swing.JPanel;
|
37
|
37
|
import javax.swing.SwingUtilities;
|
|
38
|
+import javax.swing.UIManager;
|
38
|
39
|
|
|
40
|
+import net.miginfocom.layout.PlatformDefaults;
|
39
|
41
|
import net.miginfocom.swing.MigLayout;
|
40
|
42
|
|
41
|
43
|
/** Status bar, shows message and info on the GUI. */
|
|
@@ -48,8 +50,9 @@ public final class SwingStatusBar extends JPanel implements StatusBar {
|
48
|
50
|
*/
|
49
|
51
|
private static final long serialVersionUID = 5;
|
50
|
52
|
/** Mig layout component restraints. */
|
51
|
|
- private static final String COMPONENT_CONSTRAINTS
|
52
|
|
- = "sgy components, hmax 20, hmin 20, wmin 20, shrink 0";
|
|
53
|
+ private final String componentConstraints;
|
|
54
|
+ /** Height for the status bar. */
|
|
55
|
+ private final int height;
|
53
|
56
|
/** message label. */
|
54
|
57
|
private final MessageLabel messageLabel;
|
55
|
58
|
/** error panel. */
|
|
@@ -69,6 +72,11 @@ public final class SwingStatusBar extends JPanel implements StatusBar {
|
69
|
72
|
final MainFrame mainFrame) {
|
70
|
73
|
super();
|
71
|
74
|
|
|
75
|
+ height = getFontMetrics(UIManager.getFont("Table.font")).getHeight()
|
|
76
|
+ + (int) PlatformDefaults.getUnitValueX("related").getValue();
|
|
77
|
+ componentConstraints = "sgy components, hmax "+height+", hmin "+height
|
|
78
|
+ +", wmin 20, shrink 0";
|
|
79
|
+
|
72
|
80
|
messageLabel = new MessageLabel(controller, mainFrame);
|
73
|
81
|
errorPanel = new ErrorPanel(controller, mainFrame, this);
|
74
|
82
|
updateLabel = new UpdaterLabel(controller);
|
|
@@ -76,10 +84,11 @@ public final class SwingStatusBar extends JPanel implements StatusBar {
|
76
|
84
|
|
77
|
85
|
setLayout(new MigLayout("fill, ins 0, hidemode 3"));
|
78
|
86
|
|
79
|
|
- add(messageLabel, "growx, pushx, sgy components, hmax 20, hmin 20");
|
80
|
|
- add(updateLabel, COMPONENT_CONSTRAINTS);
|
81
|
|
- add(errorPanel, COMPONENT_CONSTRAINTS);
|
82
|
|
- add(inviteLabel, COMPONENT_CONSTRAINTS);
|
|
87
|
+ add(messageLabel, "growx, pushx, sgy components, hmax "+height
|
|
88
|
+ +", hmin "+height);
|
|
89
|
+ add(updateLabel, componentConstraints);
|
|
90
|
+ add(errorPanel, componentConstraints);
|
|
91
|
+ add(inviteLabel, componentConstraints);
|
83
|
92
|
}
|
84
|
93
|
|
85
|
94
|
/** {@inheritDoc} */
|
|
@@ -112,10 +121,10 @@ public final class SwingStatusBar extends JPanel implements StatusBar {
|
112
|
121
|
remove(updateLabel);
|
113
|
122
|
remove(errorPanel);
|
114
|
123
|
remove(inviteLabel);
|
115
|
|
- add((Component) component, COMPONENT_CONSTRAINTS);
|
116
|
|
- add(updateLabel, COMPONENT_CONSTRAINTS);
|
117
|
|
- add(inviteLabel, COMPONENT_CONSTRAINTS);
|
118
|
|
- add(errorPanel, COMPONENT_CONSTRAINTS);
|
|
124
|
+ add((Component) component, componentConstraints);
|
|
125
|
+ add(updateLabel, componentConstraints);
|
|
126
|
+ add(inviteLabel, componentConstraints);
|
|
127
|
+ add(errorPanel, componentConstraints);
|
119
|
128
|
validate();
|
120
|
129
|
}
|
121
|
130
|
});
|