From a67b8820e5097f0aac6b7ea77e16c2db49733a28 Mon Sep 17 00:00:00 2001 From: sk89q Date: Thu, 19 Feb 2015 04:05:53 -0800 Subject: [PATCH] Switch to MigLayout for the main launcher frame. --- launcher/build.gradle | 1 + .../launcher/dialog/LauncherFrame.java | 22 ++++++++----------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/launcher/build.gradle b/launcher/build.gradle index 7385044..77f617d 100644 --- a/launcher/build.gradle +++ b/launcher/build.gradle @@ -15,6 +15,7 @@ dependencies { compile 'com.beust:jcommander:1.32' compile 'org.tukaani:xz:1.0' compile 'org.apache.commons:commons-compress:1.9' + compile 'com.miglayout:miglayout:3.7.4' } processResources { diff --git a/launcher/src/main/java/com/skcraft/launcher/dialog/LauncherFrame.java b/launcher/src/main/java/com/skcraft/launcher/dialog/LauncherFrame.java index fa87511..139c5cc 100644 --- a/launcher/src/main/java/com/skcraft/launcher/dialog/LauncherFrame.java +++ b/launcher/src/main/java/com/skcraft/launcher/dialog/LauncherFrame.java @@ -27,6 +27,7 @@ import com.skcraft.launcher.util.SharedLocale; import com.skcraft.launcher.util.SwingExecutor; import lombok.NonNull; import lombok.extern.java.Log; +import net.miginfocom.swing.MigLayout; import org.apache.commons.io.FileUtils; import javax.swing.*; @@ -59,8 +60,6 @@ public class LauncherFrame extends JFrame { private final JScrollPane instanceScroll = new JScrollPane(instancesTable); private WebpagePanel webView; private JSplitPane splitPane; - private final JPanel container = new JPanel(); - private final LinedBoxPanel buttonsPanel = new LinedBoxPanel(true).fullyPadded(); private final JButton launchButton = new JButton(SharedLocale.tr("launcher.launch")); private final JButton refreshButton = new JButton(SharedLocale.tr("launcher.checkForUpdates")); private final JButton optionsButton = new JButton(SharedLocale.tr("launcher.options")); @@ -92,6 +91,8 @@ public class LauncherFrame extends JFrame { } private void initComponents() { + setLayout(new MigLayout("fill, insets dialog", "[][]push[][]", "[grow][]")); + webView = WebpagePanel.forURL(launcher.getNewsURL(), false); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, instanceScroll, webView); selfUpdateButton.setVisible(false); @@ -101,18 +102,13 @@ public class LauncherFrame extends JFrame { launchButton.setFont(launchButton.getFont().deriveFont(Font.BOLD)); splitPane.setDividerLocation(200); splitPane.setDividerSize(4); + add(splitPane, "grow, wrap, span 5, gapbottom unrel"); SwingHelper.flattenJSplitPane(splitPane); - buttonsPanel.addElement(refreshButton); - buttonsPanel.addElement(updateCheck); - buttonsPanel.addGlue(); - buttonsPanel.addElement(selfUpdateButton); - buttonsPanel.addElement(optionsButton); - buttonsPanel.addElement(launchButton); - container.setLayout(new BorderLayout()); - container.setBorder(BorderFactory.createEmptyBorder(10, 10, 0, 10)); - container.add(splitPane, BorderLayout.CENTER); - add(buttonsPanel, BorderLayout.SOUTH); - add(container, BorderLayout.CENTER); + add(refreshButton); + add(updateCheck); + add(selfUpdateButton); + add(optionsButton); + add(launchButton); instancesModel.addTableModelListener(new TableModelListener() { @Override