This is becoming increasingly annoying by the minute. I want two columns, one with JLabels and one with JTextFields, they go in columns fine, but i can't resize them and they're smack bang in the middle. I want the left column to be on the left side and the JTextFields to the right of the left hand column but all parallel to each other.
This is the current code in the current method doing it:
Code:
public void createNewInvoice() {
frame.getContentPane().removeAll();
String helpText = "\n1. Enter first name"
+ "\n\n2. Enter last name"
+ "\n\n3. Enter address"
+ "\n\n4. Ensure correct information has been entered"
+ "\n\n5. Click \"Create Invoice\"";
JTextArea help = new JTextArea(helpText, 12, 30);
help.setFont(new Font("Arial", Font.PLAIN, 10));
help.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED), "Help"));
help.setLineWrap(true);
help.setWrapStyleWord(true);
help.setColumns(12);
help.setEditable(false);
/***** LEFT COLUMN ******/
JPanel text = new JPanel(new GridLayout(0,1));
JLabel firstNameText = new JLabel("First Name:");
JLabel lastNameText = new JLabel("Last Name:");
JLabel addressLineOne = new JLabel("House Name/Number:");
JLabel addressLineTwo = new JLabel("Street Name:");
JLabel addressLineThree = new JLabel("County:");
JLabel addressLineFour = new JLabel("Country:");
JLabel postCodeText = new JLabel("Post Code:");
text.add(firstNameText);
text.add(lastNameText);
text.add(addressLineOne);
text.add(addressLineTwo);
text.add(addressLineThree);
text.add(addressLineFour);
text.add(postCodeText);
/***********************/
JPanel input = new JPanel(new GridLayout(0,1));
JTextField firstName = new JTextField();
JTextField lastName = new JTextField();
JTextField addressOne = new JTextField();
JTextField addressTwo = new JTextField();
JTextField addressThree = new JTextField();
JTextField addressFour = new JTextField();
JTextField postCode = new JTextField();
input.add(firstName);
input.add(lastName);
input.add(addressOne);
input.add(addressTwo);
input.add(addressThree);
input.add(addressFour);
input.add(postCode);
JPanel main = new JPanel(new FlowLayout());
main.add(text);
main.add(input);
frame.getContentPane().add(main, BorderLayout.CENTER);
frame.getContentPane().add(help, BorderLayout.WEST);
frame.getContentPane().invalidate();
frame.getContentPane().validate();
frame.getContentPane().repaint();
}
*growls*
EDIT: Screeny
EDIT: Think i got it working now
Yup, i think that's it, just a few more configurations and i'm done