Questions tagged [maskformatter]

22 questions
17
votes
2 answers

How to use jXDatePicker with maskFormatter?

I would like to use a jxdatepicker with maskFormatter. I tried MaskFormatter maskFormatter = new MaskFormatter ("##/##/####"); JFormattedTextField field=new JFormattedTextField (maskFormatter); jXDatePicker.setEditor (field); and MaskFormatter…
Billydan
  • 395
  • 1
  • 7
  • 25
5
votes
0 answers

optional character with MaskFormatter java

I need a simple thing. I have a JFormattedTextField with MaskFormatter "##" but I want the first digit is optional. The information I want to get is the day of the month. Thanks.
PCampello
  • 167
  • 2
  • 8
4
votes
1 answer

Java: How to remove the spaces in a JFormattedTextField?

So, I've got a JFormattedTextField to let the user enter a number. The number can be from 1 to 99, so I used a MaskFormatter("##"). However, for some reason it puts 2 spaces in the text field if I enter nothing. It's annoying because if the user…
Zezombye
  • 321
  • 4
  • 16
3
votes
1 answer

Format string with MaskFormatter throws "Invalid character" exception

I have a function in which I need to set a string to the following format : #####-####-## and padded with leading zeroes. eg: 1234567 will become 00001-2345-67 98765432109 will become 98765-4321-09 I'm using MaskFormatter and my impression from the…
atamata
  • 997
  • 3
  • 14
  • 32
2
votes
1 answer

maskformatter java number and space

I used maskformatter for my jtextfield. It works like a charm but the problem is that I cant delete the number in the jtextfield. f = new MaskFormatter( "#" ); f.setValidCharacters("123456789"); How can I include the space character so that I can…
maxxy
  • 23
  • 2
1
vote
2 answers

How to clear mask formatted Jformattedtextfield

Good day all, there are 1 Jformattedtextfield (mask formatted) and 1 jcombobox on my program; The program running well first but ; If I select item ""; Jformattedtextfield doesn't return to first formatted value even used x.setvalue() or…
Suavi
  • 9
  • 2
1
vote
1 answer

JAVA / MaskFormatter: Allow Placeholder Character

I use the following code, to apply a MaskFormatter on my JFormattedTextField in order to make it accept IBANs (2 letters followed by 20 digits): MaskFormatter formatter = new MaskFormatter("UU## #### #### #### ####…
d0n.key
  • 1,318
  • 2
  • 18
  • 39
1
vote
0 answers

MaskFormatter: only low letters from 1 to infinitely allowed

I am searching for a "regular expression"/pattern for MaskFormatter where the only the first letter is Upper Case and the all other letters are low case mf = new MaskFormatter("U([L]){1,}"); This code above wont work because it does not support…
igodie
  • 497
  • 1
  • 4
  • 16
1
vote
1 answer

Applying a MaskFormatter to a column in my JTable, but the mask is only used on the first cell I edit in the column

////DOB column formats to dd/mm/yy TableColumn dobColumn = table.getColumnModel().getColumn(3); DateFormat df = new SimpleDateFormat("dd/mm/yy"); JFormattedTextField tf = new JFormattedTextField(df); tf.setColumns(8); try { …
user217339
  • 169
  • 1
  • 2
  • 11
1
vote
1 answer

Receiving text inputs via a JFormattedTextField

I am having problems taking text inputs from the user via a JFormattedTextField. I've tried passing a sample value, for example 172.16.10.0 into the text field and would like to have it transferred into the string variable strIP. Currently I am…
bornomala
  • 115
  • 2
  • 12
0
votes
1 answer

How to find the length of a JFormattedTextField

I'm trying to verify that a user has entered the correct number of integers in the phonebook to complete the contact and if not then I would issue an error message like I do when a name is not entered. Problem I run into is that the field has been…
0
votes
1 answer

using a mask in a jFormattedTextField in a javaBean Class

I Created a JFormattedTextField and using as a javaBean for multiple java Project, however, i didn't manage to figure out how use this field with a mask, the mask just doesn't work Here's my class: package org.japo.java.swing.samples; import…
0
votes
2 answers

Custom Mask disappears after date is entered into JFormattedTextField

Question ~ I have an AddButton ActionListener that I'm trying to empty a JFormattedTextField with while keeping it's Mask("##/##/####") and SimpleDateFormat. If anyone can help me with the technical part of this, that would be cool. Thanks! When…
0
votes
2 answers

Android mask formatter that allows only Integers but with text in mask

On Android I need to create a edit input that will have static text elements that do not change and other values that need to be replaced by numbers when the user types in values which the "#" symbol is used. The replacements should only be integers…
Stephen McCormick
  • 1,706
  • 22
  • 38
0
votes
1 answer

Java Swing - Maskformatter digits from Right to Left

I would like to enter in a JFormattedTextfield with a Maskformatter digits for inserting time units (min:sec with mask ##:##) from Right to the Left. I used SetComponentOrientation to get the work done. The only thing, when I type 3 digits (i.e.…
1
2