Results 1 to 4 of 4
  1. #1
    asai is offline Senior Member
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    115
    Rep Power
    0

    Default Max size of a texfield

    Hi,

    I would like to set a max size on character input in a JTextfield.

    Tried this:

    Java Code:
    textMail = new javax.swing.JTextField(20);
    But no success. Any suggestions?

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: Max size of a texfield

    Use a DocumentFilter.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  3. #3
    asai is offline Senior Member
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    115
    Rep Power
    0

    Default Re: Max size of a texfield

    Quote Originally Posted by PhHein View Post
    Use a DocumentFilter.
    Do you have an example how to do this?

  4. #4
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    6

    Default Re: Max size of a texfield

    Quote Originally Posted by asai View Post
    Do you have an example how to do this?
    No, but as always an example can be found in the tutorials: DocumentFilter
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

Similar Threads

  1. Replies: 7
    Last Post: 05-26-2012, 07:07 PM
  2. Texfield numeric Input
    By mDennis10 in forum New To Java
    Replies: 8
    Last Post: 08-10-2011, 05:52 PM
  3. Set TexField to false
    By globo in forum New To Java
    Replies: 3
    Last Post: 11-18-2010, 08:46 PM
  4. Setting frame size to the size of an image
    By Yoruichi in forum AWT / Swing
    Replies: 5
    Last Post: 04-22-2009, 04:37 PM
  5. ImageIcon and size
    By wokena in forum Java 2D
    Replies: 3
    Last Post: 12-21-2008, 08:47 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
  •