Reputation: 299
I use a gridLayout(1,2) and I put a JLabel and JTextField on it. the result at the right end looks like this:
Is there a way to add more space between the border of the jframe and the jtextfield? So the jtextfield is not so close to the frame...
Upvotes: 0
Views: 2171
Reputation: 644
Put an empty border around it:
textField.setBorder(BorderFactory.createCompoundBorder(
textField.getBorder(),
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
Upvotes: 3
Reputation: 35096
JTextField jf = new JTextField() {
public Insets getInsets() {
return new Insets (5,5,5,50);
}
}
Upvotes: 1