I'm pretty new to java but have lots of coding experience with ruby, c and gui with gtk2 and qt. I'm trying to understand (and get rid of) the dead space to the far left portion of the window. The split panes have white backgrounds to separate it from the "dead zone". This dead area also seems to grow proportionally when the window is maximized.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.io.*;
public class MainFrame extends JPanel {
private JSplitPane splitPane1;
private JSplitPane splitPane2;
private JPanel Panel2;
private JPanel Panel3;
private JPanel Panel1;
private JFrame frame;
private Font font;
MainFrame(JFrame iframe,
Container container) {
frame = iframe;
container.setLayout(new BoxLayout(container,BoxLayout.Y_AXIS));
splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane1.setPreferredSize(new Dimension(1100,800));
splitPane1.setOneTouchExpandable(true);
splitPane1.setDividerLocation(0.9);
splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
splitPane2.setOneTouchExpandable(true);
splitPane2.setDividerLocation(0.5);
font = new Font("Monospaced",Font.BOLD,14);
Panel2 = new JPanel();
Panel2.setBackground(Color.white);
Panel3 = new JPanel();
Panel3.setBackground(Color.white);
Panel1 = new JPanel();
Panel1.setBackground(Color.white);
splitPane1.setResizeWeight(0.9);
splitPane2.setResizeWeight(0.5);
splitPane1.add(splitPane2);
splitPane1.add(Panel2);
splitPane2.add(Panel3);
splitPane2.add(Panel1);
splitPane1.setVisible(true);
splitPane2.setVisible(true);
container.add(splitPane1);
}
public static void main(String args[]) {
JFrame frame = new JFrame("Title for Window");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container container = frame.getContentPane();
MainFrame mf = new MainFrame(frame,container);
frame.add(mf);
frame.pack();
frame.setSize(1100,800);
frame.validate();
frame.setVisible(true);
}
}