• Post Reply Bookmark Topic Watch Topic
  • New Topic

Urgent-JTextField, Caret Position  RSS feed

 
Priya Kannan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm developing a simple calculator application in swing, using IBM Visual age for Java, in which I want the cursor to appear towards the extreme right of the TextField. I'm having trouble doing that. Please help!!!
Thanks.
 
Jagan Mohan Reddy
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Think this code solves ur problem.

JTextField tf = new JTextField(20);

tf.setEditable(false); //Since ur application is a calculator think this statement is also necessary.

tf.setHorizontalAlignment(JTextField.RIGHT);//sets the text to be right aligned.

Regards,
Jagan Mohan Reddy.
 
Priya Kannan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that solves my problem.
Thanks a lot Mr.Reddy.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!