So this is the first time using a Spring Layout and I gotta say, it honestly seems like a very nice Layout to use, but I can't quite seem to get it working the way I want it to. Let me explain:
I have a JList which should be inset 5px on each side.
I have a Button which should be inset 5px below the JList, and 5px from the right side.
I have another Button which should be inset 5px below the list, and 5px to the left of the previous Button.
Each Button should be inset 5px from the bottom.
Here's my code:
JFrame frame = new JFrame("Force StartUp");
frame.setPreferredSize(new Dimension(600, 600));
frame.setMinimumSize(new Dimension(600, 600));
frame.setMaximumSize(new Dimension(1200, 900));
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
SpringLayout springLayout = new SpringLayout();
frame.setLayout(springLayout);
Container contentPane = frame.getContentPane();
JList<String> entryList = new JList<String>();
entryList.setPreferredSize(new Dimension(590, 555));
JButton addButton = new JButton("Add");
addButton.setPreferredSize(new Dimension(75, 25));
JButton removeButton = new JButton("Remove");
removeButton.setPreferredSize(new Dimension(100, 25));
springLayout.putConstraint(SpringLayout.WEST, entryList, 5, SpringLayout.WEST, contentPane);
springLayout.putConstraint(SpringLayout.NORTH, entryList, 5, SpringLayout.NORTH, contentPane);
//springLayout.putConstraint(SpringLayout.SOUTH, entryList, 35, SpringLayout.SOUTH, contentPane);
springLayout.putConstraint(SpringLayout.NORTH, addButton, 5, SpringLayout.SOUTH, entryList);
springLayout.putConstraint(SpringLayout.WEST, addButton, 115, SpringLayout.WEST, contentPane);
springLayout.putConstraint(SpringLayout.NORTH, removeButton, 5, SpringLayout.SOUTH, entryList);
springLayout.putConstraint(SpringLayout.WEST, removeButton, 5, SpringLayout.EAST, addButton);
springLayout.putConstraint(SpringLayout.WEST, removeButton, 5, SpringLayout.EAST, addButton);
springLayout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, entryList);
springLayout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, addButton);
springLayout.putConstraint(SpringLayout.SOUTH, contentPane, 5, SpringLayout.SOUTH, removeButton);
springLayout.putConstraint(SpringLayout.EAST, contentPane, 5, SpringLayout.EAST, removeButton);
contentPane.add(entryList);
contentPane.add(addButton);
contentPane.add(removeButton);
frame.pack();
frame.setVisible(true);