• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting limited number of characters for a text field

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am using a JFormattedTextfield and setting a Format with the constructor.
my problem is i want to limit the charcters in my field too.I can limit the characters using JTexfield when i dunno use a JFormattedTextfield .I would like to get help that how should i limit number of charcters in a JFormattedTextfield.
regards
srijan
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I understand you, I think this will help. This mask will allow up to 10 characters in the field. Looking at the Javadoc will give you more options.

To really get fancy, try this link.
RegexPatternFormatter from O'Reilly Swing Book
 
srijan sharma
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply but the problem is i cannot use both maskformatter and a formatter on text field together.I mean when i make a textfield for decimal numbers it i need to use decimal format from numberformat which i need to set precision or other properties.So if i use decimal format with JFormattedtextfield then i cannot use a mask formatter as if set it using setFormatterfactory it does not show the desired effect as two things dunno work together.hope i made myself clear
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic