File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

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 :
jtf.setHorizontalAlignment(JTextField.RIGHT_ALIGNMENT)
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?
Paul
Chad McGowan
Ranch Hand

Joined: May 10, 2001
Posts: 265
For setHorizontalAlignment(), you need to use JTextField.RIGHT
Chad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Right Alignment of JTextField