I need to store all encrypted messages so it may be retrieved and displayed by pressing a button, that is, press the button 3 times for the last 3rd message;
After retrieving an encrypted message , let user guess (type into a textbox) the original message and press a button. Display how many characters are correct and how many wrong.
Really sorry for the bad question. here's an example of my current coding. basically i take the input from a textfield. so how do i store and retrieve the input?
String input = txtInput.getText();
StringBuilder builder = new StringBuilder();
char[] charArray = input.toCharArray();
for(int i = 0; i < charArray.length; i +=2)
{
if(i+1 < charArray.length)
{
//even
builder.append(charArray[i+1]);
}
//odd
builder.append(charArray[i]);
}
String flippedText = builder.toString();
lblencryted.setText(flippedText);
for(int i = 0; i < 100; i++){
String[] storeArray = {flippedText};
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String input = txtInput.getText();
StringBuilder builder = new StringBuilder();
char[] charArray = input.toCharArray();
for(int i = 0; i < charArray.length; i +=2)
{
if(i+1 < charArray.length)
{
//even
builder.append(charArray[i+1]);
}
//odd
builder.append(charArray[i]);
}
String flippedText = builder.toString();
lblretrieve.setText(flippedText);
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Encryption().setVisible(true);
}
});
}