Reputation: 57
I am trying to add a textfield next to some check boxes, but for some reason it looks only 1 char in size?
JButton addStaff = new JButton("Add Staff");
westPanel.add(addStaff);
// bind the button with the listener
addStaff.addActionListener(new StaffHandler());
c1 = new JCheckBox("Home Only?");
westPanel.add(c1);
c2 = new JCheckBox("Offer ShortHand?");
westPanel.add(c2);
t1 = new JTextField("");
westPanel.add(t1);
My output is the following, which looks a bit rubbish.
Upvotes: 1
Views: 1195
Reputation: 302
You can use the constructor new JTextField(int columns)
e.g. JTextField t1 = new JTextField(20);
Upvotes: 3