Tf Align

// Create a text field with some initial text
JTextField textfield = new JTextField("Initial Text");

// Left-justify the text
textfield.setHorizontalAlignment(JTextField.LEFT);

// Center the text
textfield.setHorizontalAlignment(JTextField.CENTER);

// Right-justify the text
textfield.setHorizontalAlignment(JTextField.RIGHT);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.