How can I add some padding to a jtextfield?
I\'ve tried tf.setMargin(new Insets(5,5,5,5)); which doesn\'t have any effect.
I know this is years too late, but actually, if you want a consistent look and feel in Java, you should be editing the UI so every text field you create doesn't need its own special code. So, taking from Russel Zahniser's example above:
Border tfBorder = UIManager.getBorder("TextField.border");
Border newBorder = BorderFactory.createCompoundBorder(tfBorder,
BorderFactory.createEmptyBorder(5, 5, 5, 5)));
UIManager.setBorder("TextField.border", newBorder);