Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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
 
Evacuate the building! Here, take this tiny ad with you:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic