I have 3 panels. One of them is the main panel, on which two small panels are located.
For the main panel, I used
setPreferredSize(new Dimension(350, 190));
For the smaller left panel I used
setPreferredSize(new Dimension(100, 190));
For the smaller right pane, I used
setPreferredSize(new Dimension(250, 190));
but smaller panels remain the same size. How can i fix this? 
This is the code that I have in my main panel.
import model.*; import java.awt.*; import javax.swing.*; public class Panel extends JPanel { public Panel(Prison prison) { setup(); build(prison); } private void setup() { setBorder(BorderFactory.createLineBorder(Color.blue)); setLayout(new BorderLayout(1, 1)); setPreferredSize(new Dimension(350, 190)); } private void build(Prison prison) { JTabbedPane tab = new JTabbedPane(); tab.addTab("Input", null, new InputPanel(), "Input"); tab.addTab("Display", null, new DisplayPanel(), "Display"); add(tab); } }
Karen source share