Results 1 to 3 of 3
  1. #1
    prabhurangan is offline Member
    Join Date
    May 2008
    Posts
    69
    Rep Power
    0

    Post [SOLVED] JtextField alignments issue.......?

    Hi Members,

    Im using jtextField to display some description message, but when the 'message extends greater than the textfield size, it automatically gets aligned from 'Right to Left', but i need to show it from 'Left to Right' aligned.

    I also tried 'JtextField.setHorizontalAlignment(JTextField.LEFT );' but it is not working when the message size is greater than textfield size.

    Looking forward for your reply.

    Regards,
    Prabhu.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    It makes sense for Java to behave this way, as if you are typing into the textfield and it is longer than the space allowed, you want to be able to see what you are typing in, i.e., the right side of the text.

    Now I'm guessing that you're not doing that, you're not typing in information, but instead the program is sending information into the jtextfield via its setText(...) method? (hint: you will get better quality answers if you provide all the information necessary for us at the get-go). If so, you may solve this by inserting your text and then calling on your JTextField the setCaretPosition method: myTextField.setCaretPosition(0);

  3. #3
    prabhurangan is offline Member
    Join Date
    May 2008
    Posts
    69
    Rep Power
    0

    Default

    Hi Fubarable,

    Thank you very much; issue has been solved.
    Im much proud to be a member of the forum; where solving post with members help is done in fraction of days.

    Catch you on further post.

    Bye,
    Prabhu.

Similar Threads

  1. how to focus to another JTextfield?
    By birdofprey in forum AWT / Swing
    Replies: 2
    Last Post: 04-09-2008, 01:08 PM
  2. Using Columns With JTextField
    By The Evil Genius in forum AWT / Swing
    Replies: 1
    Last Post: 03-17-2008, 01:01 AM
  3. Clean the content of the JTextField
    By elizabeth in forum AWT / Swing
    Replies: 1
    Last Post: 07-26-2007, 08:38 PM
  4. help with JTextfield
    By gary in forum New To Java
    Replies: 4
    Last Post: 07-11-2007, 01:58 PM
  5. Replies: 1
    Last Post: 05-20-2007, 11:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •