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