How do I right align numbers in a textfield?
This is yet another example of why the Swing classes should be used in
lieu of the AWT classes. Swing components contain a significant
degree of added functionality not included in the base AWT package.
The java.awt.TextField does not support the customization of text
alignment. However, javax.swing.JTextField does. It includes a
method called setHorizontalAlignment which can take an argument of
JTextField.LEFT, JTextField.CENTER, or JTextField.RIGHT to customize
the text alignment. For your situation, you would use JTextField.RIGHT.