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);
}
}