It shouldn't be that complicated
Ive done this with htree splitPanes.
Just one thing, if the main part is flexible w & h then the left part (the
the navigation) must be flexible width too, or else you get some realestate
on the screen that is not accounted for....
And if you want the left & main part to have flexible height then that leaves
you with two empry spaces (emptyPan1 & emptyPan2).
Code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
* An Application Layout Template
*/
public class AppFrame extends JFrame {
JSplitPane mainSplitPane = new JSplitPane();
JSplitPane leftSplitPane = new JSplitPane();
JSplitPane rightSplitPane = new JSplitPane();
JPanel navPanel = new JPanel();
JPanel emptyPan1 = new JPanel();
JPanel contentPanel = new JPanel();
JPanel emptyPan2 = new JPanel();
JLabel statusLbl = new JLabel();
public AppFrame() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
AppFrame appFrame = new AppFrame();
appFrame.setBounds(20,20,600,500);
appFrame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
appFrame.setVisible(true);
}
private void jbInit() throws Exception {
leftSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
rightSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
this.setTitle("Standard App Layout");
statusLbl.setBorder(BorderFactory.createEtchedBorder());
statusLbl.setText("That\'s it....?");
this.getContentPane().add(mainSplitPane, BorderLayout.CENTER);
mainSplitPane.add(leftSplitPane, JSplitPane.LEFT);
leftSplitPane.add(navPanel, JSplitPane.TOP);
leftSplitPane.add(emptyPan1, JSplitPane.BOTTOM);
mainSplitPane.add(rightSplitPane, JSplitPane.RIGHT);
rightSplitPane.add(contentPanel, JSplitPane.TOP);
rightSplitPane.add(emptyPan2, JSplitPane.BOTTOM);
this.getContentPane().add(statusLbl, BorderLayout.SOUTH);
leftSplitPane.setDividerLocation(250);
mainSplitPane.setDividerLocation(170);
rightSplitPane.setDividerLocation(250);
}
}