I am very new to java...i am to construct a frame similar to this diagram contains 2 text fields on left and 2 buttons on right. uses the following 2 strings originalCharacter = "abcde" encryptionCharacter = "edcba"
when user clicks on Encrypt button your program should convert the content of original text-text field from originalCharacter to the encryptionCharacter. result should be displayed in the encrypted text-text field. when the user clicks on the Decrypt button it should reverse the process.
I hope this layout looks ok on posted page _________________________________
Original Text________ _______ |________| |Encrypt| |_______|
Encrypted Text _______ _______ |_______| |Decrypt| |_______|
Hint: Before and after the code put [ java ] and [ /java ] (without the empty spaces, and use other indizes than [ i ] or [ b ] because these are reserved, as you can see on the right side.
Now ... what is your question? That someone of us creates the layout for you? Or the events that occur when you press abutton?
If you want to go the easy way, then use a Null-Layout and set the components positions and size.
I normally use GridBagLayout for allmost everything. It is more complicated, but it makes the window resizable.
For the events: You need 2 different action handlers for the buttons (or you use the ActionCommand String for determining what should be done): Give every button a unique actioncommand, then in the handler check what action command is stored in the event (use the equals method, == doesn't work for Strings.) Where are your crypt / decrypt methods?
To get Text from a Textfield use the getText() method. To set text to a textfield use setText(String).