tags:

views:

51

answers:

1

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);
        }
    });
}
+3  A: 

You've got several problems here. Since computer science is all about solving large problems by breaking them into smaller ones, I'd recommend that you think about these steps:

  1. How to connect to a database? JDBC is your answer.
  2. How to query a table in a database? JDBC is your answer.
  3. How to click on a button? The answer depends on whether the button is part of a Swing desktop app or a web app running in a browser.
  4. How to translate a button click event into a database query? The answer depends on whether the button is part of a Swing desktop app or a web app running in a browser.
  5. How do I structure an application that requires communication between a user interface and a database? The best way is to have a layered architecture: one set of interfaces for database access, another to act as the intermediary between the user interface and the database, and a view tier. Look into Model-View-Controller, or MVC.

Your question couldn't be more vague. I'm voting to close it until you edit it into something more sensible. Post what you have so far or tighten up your question.

duffymo
I thought you couldn't rescind votes...
NullUserException
Who rescinded a vote? I voted to close, nothing more.
duffymo