Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSplitPane won't resize

843804Nov 11 2004 — edited Dec 14 2004
Hello to everyone. This is my first post and my English is not my native language so please be nice with me.

I have a problem with a JSplitPane. I'm adding a panel to my frame's content pane that extends from JPanel. In this panel I have a SlpiPane which has another SplitPane.

My problem is that when I maximize my frame my SplitPane won't resize, it keeps with the same size and I don't want this.

Thank you in advance,
iL Huevo


Here is the code of mi panel that implements two SplitPanes:
import javax.swing.*;
import java.awt.*;

public class MailMainPanel extends JPanel{

    private MailMainFrame mailFrame;
    private JPanel panelCarpetas, panelMails, panelVista;
    private JSplitPane divCarp, divMails;

    public MailMainPanel(){

        panelCarpetas = new JPanel();
        panelMails = new JPanel();
        panelVista = new JPanel();
       
        initGUI();
    }

    private void initGUI() {

        panelCarpetas.setBackground(Color.BLACK);
        panelCarpetas.setPreferredSize(new Dimension(300,400));


        panelMails.setBackground(Color.WHITE);
        panelVista.setBackground(Color.GREEN);
        panelVista.setPreferredSize(new Dimension(150, 300));
        panelMails.setPreferredSize(new Dimension(150, 300));

        divMails = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, panelMails, panelVista);
        divCarp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, panelCarpetas, divMails);

        add(divCarp);

    }

    public static void main(String [] args){

        MailMainPanel panel = new MailMainPanel();
        JFrame frame = new JFrame("Pepe");

        frame.getContentPane().add(panel);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2005
Added on Nov 11 2004
2 comments
403 views