Results 1 to 5 of 5
  1. #1
    jdipierro is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default Text-field templates.

    I was wondering if it's possible to have a "template" in a text field in Java, and how to program it?

    What I'm looking to do is have a field that has (___)___-____ and when you type a phone number in the field the (, ), and - stay in place. I think I've seen this done on online forms, and was wondering if it's possible in a Java program?

    Thanks!
    JD

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default

    Not with a vanilla text field.
    You might be able to create one by extending a class and adding code to present the template and to skip over the template characters as keys are pressed.

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

  4. #4
    jdipierro is offline Member
    Join Date
    May 2010
    Posts
    3
    Rep Power
    0

    Default

    You're making the assumption that 1. I knew that existed and 2. I know how to work that :3 I'm a TOTAL nub... attempting to self-teach, not going too quickly :P

    I'll do me some reading but it seems that that may be what I'm looking for so thank you!

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

    Default

    Quote Originally Posted by jdipierro View Post
    You're making the assumption that...
    No assumptions have been made when creating my previous post and no animals were harmed. I simply asked if you looked into using the JFormattedTextField, that's all. I guess the answer is no.

    I'll do me some reading but it seems that that may be what I'm looking for so thank you!
    Sounds good to me, and you're welcome (if it helps).

    Have a look here first: http://java.sun.com/docs/books/tutor...textfield.html

    Much luck.

Similar Threads

  1. Refreshing Text Field Value
    By nehakuls in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 11-13-2009, 11:05 AM
  2. How To add the Text field to the TextArea or TextPane
    By Chintan Patel in forum AWT / Swing
    Replies: 3
    Last Post: 04-08-2009, 02:46 AM
  3. need to add text field on existing dialog
    By SHAshank1 in forum SWT / JFace
    Replies: 0
    Last Post: 07-23-2008, 03:15 PM
  4. get numeric value from a text field
    By Lehane_9 in forum New To Java
    Replies: 2
    Last Post: 06-14-2008, 03:19 AM
  5. Regarding Text Field
    By adeeb in forum AWT / Swing
    Replies: 1
    Last Post: 06-05-2008, 11:01 PM

Posting Permissions

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