views:

144

answers:

1

I want some like this:

http://eta.name/timages/JPanel_Layout.png (sorry, I have no reputation to post image)

How make it ideologically correct?

+1  A: 

Your requirement seems to be a relatively simple use of BorderLayout.

The code snippet below assumes the panel are being added to a JFrame. Hence the getContentPane() calls.

    javax.swing.JPanel jPanel1 = new javax.swing.JPanel();
    javax.swing.JPaneljPanel2 = new javax.swing.JPanel();

    jPanel1.setMaximumSize(new java.awt.Dimension(60, 32767));
    jPanel1.setMinimumSize(new java.awt.Dimension(60, 100));
    jPanel1.setPreferredSize(new java.awt.Dimension(60, 300));

    getContentPane().add(jPanel1, java.awt.BorderLayout.WEST);

    getContentPane().add(jPanel2, java.awt.BorderLayout.EAST);

Specify the maximum, minimum and preferred width of jPanel1 to be 60 px. Leave JPanel2 to "float".

If separation of the panes is required add a third pane of fixed width (say 5 px)

getContentPane().add(jPanel3, java.awt.BorderLayout.CENTER);
FacilityDerek