im developing a language converter
so i want to do like this

source | target (this is only example)
aa | q
bb | w
cc | e

im using netbeans ide
i have a one textfield for input strings and textarea(i used textarea becoz i dont know how to append textfield) to display converted string
this is my code

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String source ;
jtextArea1.append(source.replace("aa", "q"));
jtextArea1.append(source.replace("bb", "w"));
jtextArea1.append(source.replace("cc", "e"));

this dosent work
if i input aabb i get qbbaaw
i want qw

how to fix this????
plzz help me

Edited by y2kshane: n/a

7 Years
Discussion Span
Last Post by NormR1

Try debugging your code by making the method calls separately and printing out the values or the variables as they are executed. You must not be using the methods correctly. By doing each step by itself and examining the results you will see what you are doing wrong.

jtextArea1.append(source.replace("aa", "q"));

String str1 = source.replace("aa", "q");
// here print out str1 and source

do the same for the next two also

Edited by NormR1: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.