I am creating a singlish software.Don't think the word "Singlish" :-).
this is my code,
private void txt_titleKeyTyped(java.awt.event.KeyEvent evt) {
char c = evt.getKeyChar();
switch (c) {
case 'a':
txt_body.setText(txt_body.getText() + "අ");
break;
case 's':
txt_body.setText(txt_body.getText() + "ස");
break;
}
}
In this application ,when i am typing letter "a" program prints a specific character.I have two questions ,
if I press letter "a" the program prints the correct character ("අ") and also prints "a"
(like this "අa"). only I need "අ".how to prevent print "a".If i typed "aa" ,I need to print a another character.so I tried
case 'aa': txt_body.setText(txt_body.getText() + "ආ"); break;
but there is a error "Unclosed character literal" Is there any way to assign two characters to a char like in
javaScript
.