All I want to do, If I'm pressing '{' this key in JtextArea.automatically '}' this will be print also.
if(evt.KEY_PRESSED == '{')
System.out.print("}");
is this is okay??
All I want to do, If I'm pressing '{' this key in JtextArea.automatically '}' this will be print also.
if(evt.KEY_PRESSED == '{')
System.out.print("}");
is this is okay??
I think this is what you are looking for
Tested and works
You need KeyBinding http://tips4java.wordpress.com/2008/10/10/key-bindings/ and http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html
for listening changes into JTextComponent is there DocumentListener, if you have to need control over inputed Char, sings, whitespace chars or word(s) you have to implements DocumentFilter
notice for Chars reservated by programing language(s) you have to use double escapes,
\\(
instead of(
or
\\{
instead of{
otherwise you get
for example