Permalink
Browse files

added split panes for main panels

  • Loading branch information...
1 parent 7d61f82 commit d7645314dcad8191f9151bb12038ecf9fc480eb2 @stefanbrenner committed Feb 1, 2012
@@ -83,7 +83,7 @@ public ActionDevicePanel(T device) {
actionsPanel.setLayout(new BoxLayout(actionsPanel, BoxLayout.Y_AXIS));
actionsPanel.setBackground(getBackground());
- JScrollPane scrollPane = new JScrollPane(actionsPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane scrollPane = new JScrollPane(actionsPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
// resize vertical scrollbar
scrollPane.getVerticalScrollBar().putClientProperty("JComponent.sizeVariant", "mini");
@@ -23,8 +23,6 @@
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Frame;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
@@ -33,6 +31,7 @@
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
+import javax.swing.JSplitPane;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
@@ -44,7 +43,6 @@
import com.stefanbrenner.droplet.model.internal.Droplet;
import com.stefanbrenner.droplet.model.internal.DropletContext;
import com.stefanbrenner.droplet.ui.actions.StartAction;
-import com.stefanbrenner.droplet.utils.UiUtils;
public class DropletMainFrame extends JFrame {
@@ -134,24 +132,20 @@ public DropletMainFrame() {
contentPane.add(commPanel, BorderLayout.NORTH);
{
- JPanel mainPanel = new JPanel();
- mainPanel.setLayout(new GridBagLayout());
- contentPane.add(mainPanel, BorderLayout.CENTER);
-
- GridBagConstraints gbc = UiUtils.createGridBagConstraints();
- gbc.fill = GridBagConstraints.BOTH;
-
configPanel = new DeviceSetupPanel(dropletContext.getDroplet());
- UiUtils.editGridBagConstraints(gbc, 0, 0, 1, 1);
- mainPanel.add(configPanel, gbc);
-
processingPanel = new ProcessingPanel();
- UiUtils.editGridBagConstraints(gbc, 0, 1, 1, 0);
- mainPanel.add(processingPanel, gbc);
-
loggingPanel = new LoggingPanel();
- UiUtils.editGridBagConstraints(gbc, 0, 2, 1, 0);
- mainPanel.add(loggingPanel, gbc);
+
+ JSplitPane splitPaneBottom = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, processingPanel, loggingPanel);
+ splitPaneBottom.setOneTouchExpandable(true);
+ splitPaneBottom.setDividerLocation(0.5d);
+ splitPaneBottom.setResizeWeight(0.0d);
+
+ JSplitPane splitPaneMain = new JSplitPane(JSplitPane.VERTICAL_SPLIT, configPanel, splitPaneBottom);
+ splitPaneMain.setOneTouchExpandable(true);
+ splitPaneMain.setDividerLocation(0.5d);
+ splitPaneMain.setResizeWeight(1.0d);
+ contentPane.add(splitPaneMain, BorderLayout.CENTER);
}
toolbarPanel = new DropletToolbar(dropletContext);
@@ -19,9 +19,8 @@
*******************************************************************************/
package com.stefanbrenner.droplet.ui;
+import java.awt.BorderLayout;
import java.awt.Font;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
import java.awt.Insets;
import java.text.DateFormat;
import java.util.Date;
@@ -34,8 +33,6 @@
import org.apache.commons.lang3.StringUtils;
-import com.stefanbrenner.droplet.utils.UiUtils;
-
/**
* @author Stefan Brenner
*/
@@ -50,21 +47,17 @@
*/
public LoggingPanel() {
- setLayout(new GridBagLayout());
+ setLayout(new BorderLayout());
setBorder(BorderFactory.createTitledBorder("Logging"));
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.fill = GridBagConstraints.BOTH;
-
- txtMessages = new JTextArea(5, 50);
+ txtMessages = new JTextArea();
txtMessages.setFocusable(false);
txtMessages.setFocusTraversalKeysEnabled(true);
txtMessages.setMargin(new Insets(10, 10, 10, 10));
txtMessages.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
txtMessages.setEditable(false);
JScrollPane loggingScrollPane = new JScrollPane(txtMessages);
- UiUtils.editGridBagConstraints(gbc, 0, 0, 1, 0);
- add(loggingScrollPane, gbc);
+ add(loggingScrollPane, BorderLayout.CENTER);
}
@@ -31,10 +31,14 @@
*/
public class DropletDimensions {
+ public static final int WIDTH_MAX = Short.MAX_VALUE;
+
public static final int WIDTH_ACTION = 180;
public static final int WIDTH_DURATION_ACTION = 290;
+ public static final int HEIGHT_MAX = Short.MAX_VALUE;
+
public static final int HEIGHT_MIN = 220;
public static Dimension getDimension(IDevice device) {

0 comments on commit d764531

Please sign in to comment.