changeset 11:1298f5b16ecf

switch to GridBagLayout
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 13 Sep 2011 03:29:11 +0200
parents a5ef4fbfd90c
children 18e126f0070b
files conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java	Tue Sep 13 02:33:01 2011 +0200
+++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java	Tue Sep 13 03:29:11 2011 +0200
@@ -1,8 +1,9 @@
 
 package de.codedo.conflicteditor.gui;
 
-import java.awt.BorderLayout;
 import java.awt.FlowLayout;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
 import java.awt.HeadlessException;
 
 import javax.swing.JButton;
@@ -27,7 +28,7 @@
     {
         super();
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-        setLayout(new BorderLayout());
+        setLayout(new GridBagLayout());
         buildGui();
     }
 
@@ -44,12 +45,20 @@
         _findConflictsButton = new JButton("Find Conflicts");
 
         JPanel databaseUrlPanel = new JPanel();
-        databaseUrlPanel.setLayout(new FlowLayout());
+        FlowLayout layout = new FlowLayout(FlowLayout.LEFT);
+        databaseUrlPanel.setLayout(layout);
         databaseUrlPanel.add(label);
         databaseUrlPanel.add(_databaseUrlTextField);
         databaseUrlPanel.add(_findConflictsButton);
 
-        getContentPane().add(databaseUrlPanel, BorderLayout.NORTH);
+        GridBagConstraints constraints = new GridBagConstraints();
+        constraints.gridx = 0;
+        constraints.gridy = 0;
+        constraints.weightx = 0.5;
+        constraints.weighty = 0.1;
+        constraints.anchor = GridBagConstraints.LINE_START;
+        constraints.fill = GridBagConstraints.HORIZONTAL;
+        getContentPane().add(databaseUrlPanel, constraints);
     }
 
     private void buildConflictsListAndDifferencesTable()
@@ -63,7 +72,14 @@
         JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
         splitPane.add(conflictsScrollPane);
         splitPane.add(differencesScrollPane);
-        getContentPane().add(splitPane, BorderLayout.CENTER);
+
+        GridBagConstraints constraints = new GridBagConstraints();
+        constraints.gridx = 0;
+        constraints.gridy = 1;
+        constraints.weightx = 0.5;
+        constraints.weighty = 0.9;
+        constraints.fill = GridBagConstraints.BOTH;
+        getContentPane().add(splitPane, constraints);
     }
 
     private void buildConflictsList()