I'm using the JFormattedTextField.

I set it document filter to my specific size, it works with normal alpha numeric character.

My problem right now is when the input is a combination of Japanese characters and alphabet.

My textfield needs only to accept 26 bytes,so
right now Im using the getBytes() functionality to control the bytes input.

Using the "InputMethodTextChangeEvent" , if the condition is satisfied, then I would consume the event and commit the text

Code:
  
private void jText_InputMethodTextChanged(java.awt.event.InputMethodEvent evt)													   
	{														   
		 
		if( this.jText_01.getText().getBytes().length == 26 )
		{
			System.out.println("Consuming Event");	  
			evt.consume();
			try
			{
				System.out.println("Committing ... ");
				this.jText_01.commitEdit();
			}
			catch(Exception e)
			{
				System.out.println(e.getCause().toString());
			}
		}
	}
what i want to do, is that when I commitEdit(), I want to flushed the Input Stream to get rid of unnecessary string. Is there a way to do this?