Browse Source

Fix issues with treeview and status bar on gnome3.

Change-Id: Ib4f7d4cd92109a5c7b8a994a5692d57a2ed9b10f
Reviewed-on: http://gerrit.dmdirc.com/2343
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.7rc1
Greg Holmes 12 years ago
parent
commit
536e89d16a

+ 6
- 1
src/com/dmdirc/addons/ui_swing/MainFrame.java View File

@@ -62,8 +62,10 @@ import javax.swing.JPanel;
62 62
 import javax.swing.JSplitPane;
63 63
 import javax.swing.MenuSelectionManager;
64 64
 import javax.swing.SwingUtilities;
65
+import javax.swing.UIManager;
65 66
 import javax.swing.WindowConstants;
66 67
 
68
+import net.miginfocom.layout.PlatformDefaults;
67 69
 import lombok.Getter;
68 70
 import net.miginfocom.swing.MigLayout;
69 71
 
@@ -402,8 +404,11 @@ public final class MainFrame extends JFrame implements WindowListener,
402 404
      * Lays out the this component.
403 405
      */
404 406
     private void layoutComponents() {
407
+        final int height = getFontMetrics(UIManager.getFont("Table.font"))
408
+                .getHeight() + (int) PlatformDefaults.getUnitValueX("related")
409
+                .getValue();
405 410
         getContentPane().add(mainSplitPane, "grow, push");
406
-        getContentPane().add(statusBar, "hmax 20, wmax 100%-2*rel, "
411
+        getContentPane().add(statusBar, "hmax "+height+", wmax 100%-2*rel, "
407 412
                 + "wmin 100%-2*rel, south, gap rel rel 0 rel");
408 413
     }
409 414
 

+ 19
- 10
src/com/dmdirc/addons/ui_swing/components/statusbar/SwingStatusBar.java View File

@@ -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
             });

+ 3
- 1
src/com/dmdirc/addons/ui_swing/framemanager/tree/Tree.java View File

@@ -41,6 +41,7 @@ import javax.swing.JComponent;
41 41
 import javax.swing.JMenuItem;
42 42
 import javax.swing.JPopupMenu;
43 43
 import javax.swing.JTree;
44
+import javax.swing.UIManager;
44 45
 import javax.swing.tree.TreeModel;
45 46
 import javax.swing.tree.TreePath;
46 47
 import javax.swing.tree.TreeSelectionModel;
@@ -95,7 +96,8 @@ public class Tree extends JTree implements MouseMotionListener,
95 96
         getSelectionModel().setSelectionMode(
96 97
                 TreeSelectionModel.SINGLE_TREE_SELECTION);
97 98
         setRootVisible(false);
98
-        setRowHeight(16);
99
+        setRowHeight(getFontMetrics(
100
+                UIManager.getFont("Tree.font")).getHeight() + 2);
99 101
         setOpaque(true);
100 102
         setBorder(BorderFactory.createEmptyBorder(
101 103
                 (int) PlatformDefaults.getUnitValueX("related").getValue(),

Loading…
Cancel
Save