I want to display the quote (character) into a text in netbeans Swing form. But it shows only last character. Any help would be appreciated.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String t = encodeText.getText();
String text = t.toUpperCase();
int[]textnum = new int[text.length()];
for(int i=0; i<text.length(); i++) {
if(text.charAt(i)>64 && text.charAt(i)<91) {
textnum[i] = text.charAt(i)-65;
} else if(text.charAt(i) == 32) {
textnum[i] = 26;
}
}
int[] g = new int[27];
Random random = new Random();
for(int i=0; i<g.length; i++) {
g[i] = i;
// System.out.println(g[i]);
}
for(int i=0; i<50; i++) {
int e = random.nextInt(26);
int f = random.nextInt(26);
int temp = g[e];
g[e] = g[f];
g[f] = temp;
}
int[] encoded = new int[textnum.length];
for(int i=0; i<textnum.length; i++) {
encoded[i] = g[textnum[i]];
}
for(int i=0; i<encoded.length; i++) {
char alphabet = (char) (encoded[i] + 65);
if(alphabet == 91) {
alphabet = 32;
}
String c = Character.toString(alphabet);
jTextArea1.setText(c);
}
}