1
0
mirror of https://github.com/SKCraft/Launcher.git synced 2024-11-24 12:16:28 +01:00

Switch to MigLayout for the main launcher frame.

This commit is contained in:
sk89q 2015-02-19 04:05:53 -08:00
parent ab6ec9ed71
commit a67b8820e5
2 changed files with 10 additions and 13 deletions

View File

@ -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 {

View File

@ -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