Skip to content

Commit

Permalink
Fix layout issue from MigLayout update
Browse files Browse the repository at this point in the history
The mainframe just laid out really badly, splitpane didn't grow, the
statusbar was underneath things.
  • Loading branch information
greboid committed Jul 31, 2016
1 parent a9a8b25 commit 15dc5f8
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ui_swing/src/main/java/com/dmdirc/addons/ui_swing/MainFrame.java
Expand Up @@ -47,23 +47,23 @@
import com.dmdirc.ui.CoreUIUtils;
import com.dmdirc.util.collections.QueuedLinkedHashSet;

import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.Optional;

import javax.inject.Provider;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import net.engio.mbassy.listener.Handler;
import net.miginfocom.layout.PlatformDefaults;
import net.miginfocom.swing.MigLayout;

import net.engio.mbassy.listener.Handler;
import static com.dmdirc.addons.ui_swing.SwingPreconditions.checkOnEDT;
import static java.util.function.Predicate.isEqual;

Expand Down Expand Up @@ -279,8 +279,7 @@ public void initComponents() {

setPreferredSize(new Dimension(800, 600));

getContentPane().setLayout(new MigLayout(
"fill, ins rel, wrap 1, hidemode 2"));
getContentPane().setLayout(new BorderLayout());
layoutComponents();

setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
Expand Down Expand Up @@ -330,9 +329,11 @@ public void setStatusBar(final SwingStatusBar statusBar) {
* Lays out the this component.
*/
private void layoutComponents() {
getContentPane().add(mainSplitPane, "grow, push");
getContentPane().add(statusBar, "wmax 100%-2*rel, "
+ "wmin 100%-2*rel, south, gap rel rel 0 rel");
int gap = (int) PlatformDefaults.getPanelInsets(0).getValue();
mainSplitPane.setBorder(BorderFactory.createEmptyBorder(gap, gap, gap, gap));
statusBar.setBorder(BorderFactory.createEmptyBorder(0, gap, gap, gap));
getContentPane().add(mainSplitPane, BorderLayout.CENTER);
getContentPane().add(statusBar, BorderLayout.PAGE_END);
}

/**
Expand Down

0 comments on commit 15dc5f8

Please sign in to comment.