File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Right Alignment of JTextField Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Right Alignment of JTextField" Watch "Right Alignment of JTextField" New topic

Right Alignment of JTextField

Paul Keohan
Ranch Hand

Joined: Mar 15, 2000
Posts: 411
If I want to enter text from the right side of a JTextField what do I need to do?
I have a JTextField object called jtf
I do :
Firstly this doesn't compile because the field is a float but the method expects an int. When I cast it to int it compiles alright but I get a runtime error saying it's an invalid parameter.
Any ideas?
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
For setHorizontalAlignment(), you need to use JTextField.RIGHT
I agree. Here's the link:
subject: Right Alignment of JTextField
It's not a secret anymore!