Re: Filterning Input Length
if jText_01 is a JFormattedTextField object then it has a setText() method that it inherits from JTextComponent. Have you tried to call this method and pass it ""?
Re: Filterning Input Length
I don't really understand what your problem is - if you want to limit input to 26 bytes, use a DocumentFilter. Where does InputStream come into it?
Are you quite sure you want to measure this in bytes? Java uses Unicode characters, which are multi-byte...
No matter how far down the wrong road you have gone, turn back now...
Turkish proverb
Re: Filterning Input Length
as I have mentioned the DocumentFilter works well if the character encoding is ROMAN Letters.
the problem is when the input FULL_WIDTH, JAPANESE CHARACTERS.
example you have the same string below:
String strNormal = new String("12345");
String strJapn = new String("12345");
if you get the string length for both string, it will both return size = 5, but if you get the byte length
strNormal = 5
strJapn = 10
so since, input is limited to 26 , for strNormal you can still input 11 more characters
but for strJapn , if you are going to continue inputing Japanese charatecters you can only input 8 more japanese characters
and then there is also a combination of both alphanumeric and japanese characters .
somehow we were able to control the input, using the keypressed, keyrelease, and inputMethodTextChange events..