JTextField: setHorizontalAlignment(int alignment)
import javax.swing.JTextField; public class Main{ public static void main(String[] argv) { JTextField textfield = new JTextField(10); textfield.setHorizontalAlignment(JTextField.RIGHT); } }