import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class GUI extends JFrame
{
	private static final int H = 970; // Height of window
	private static final int W = 590; // Width of window
	
	private static int LM = 10;	//left margin
	private static int TM = 10; // Top margin
	
	private static final int LM2 = 300;	//Second Left margin (2nd column)
	
	private static final int VM = 10;	//Vertical Margin

	private static final int WSIZE = 260; // Width of sub window
	private static final int HSIZE = 250; // Height of sub window
	
	private static final String[] labelNames = {"Enter text to encrypt", 
			"Generated key", "Generated text", "Enter text to decrypt",
			"Enter key", "Decrypted text"};
	
	private static final int size = labelNames.length;
	
	private JLabel[] labels 	  = new JLabel[size];
	private JTextArea[] textBoxes = new JTextArea[size];
	
	private static final String BUTTON_NAME1 = "Encrypt";
	private static final String BUTTON_NAME2 = "Decrypt";
	private static final String[] BTN_NAMES = {BUTTON_NAME1, BUTTON_NAME2};
	
	
	private JButton[] buttons = new JButton[2];
	private ButtonPress onBtnPress = new ButtonPress();
	
	private Translator trans = new Translator();

	public GUI()
	{
		Container cp = getContentPane(); // Content pane
		cp.setLayout(null); // No layout manager
		setSize(W, H); // Size of Window
		setTitle("'Ashu' Enc/Dec 0.7 by Almas. Alpha tester - Atheryos");
		Font font = new Font("Monospaced", Font.PLAIN, 12); // Font Used
		
		for (int i = 0; i < size; i++)
		{
			labels[i] = new JLabel(labelNames[i]);
			labels[i].setFont(font);
			
			textBoxes[i] = new JTextArea();
			textBoxes[i].setFont(font);
			textBoxes[i].setLineWrap(true);
			
			LM = (i >= 3) ? 300 : 10;
			
			if (i == 3)
				TM = 10;
			
			labels[i].setBounds(LM, TM, 150, 20);
			TM += 30;
			textBoxes[i].setBounds(LM, TM, WSIZE, HSIZE);
			TM += HSIZE + 10;
			
			cp.add(labels[i]);
			cp.add(textBoxes[i]);
		}
		
		for (int i = 0; i < buttons.length; i++)
		{
			buttons[i] = new JButton(BTN_NAMES[i]);
			if (i == 0)
				buttons[i].setBounds(10, 880, WSIZE, 40);
			else
				buttons[i].setBounds(300, 880, WSIZE, 40);
			buttons[i].addActionListener(onBtnPress);
			cp.add(buttons[i]);
		}
		
		setDefaultCloseOperation(EXIT_ON_CLOSE);// Exit on close
	}
	
	class ButtonPress implements ActionListener
	{
		public void actionPerformed(ActionEvent ae)
		{
			String text = "";
			
			switch(ae.getActionCommand())
			{
				case BUTTON_NAME1:
					
					text = textBoxes[0].getText();
					textBoxes[1].setText(trans.encrypt(text));
					textBoxes[2].setText(trans.getKey());
					break;
					
				case BUTTON_NAME2:
					
					text = textBoxes[3].getText();
					String key = textBoxes[4].getText();
					textBoxes[5].setText(trans.decrypt(text, key));	
					break;
					
				default:
					break;
			}
		}
	}
}

@@ -221,22 +221,29 @@
  static 
+final 
 int LM
+1
  = 10;%09/
@@ -259,53 +259,8 @@
 gin%0A
-%09private static int TM = 10; // Top margin%0A%09%0A
 %09pri
@@ -380,16 +380,135 @@
 l Margin
+ inbetween %0A%09%0A%09private static final int WLABEL = 150; // w oflabel%0A%09private static final int HLABEL = 20; // h of label
 %0A%0A%09priva
@@ -620,32 +620,91 @@
 of sub window%0A%09%0A
+%09private static final int HBTN = 40; // Height of button%0A%09%0A
 %09private static 
@@ -1525,17 +1525,17 @@
 c/Dec 0.
-7
+8
  by Alma
@@ -1853,16 +1853,20 @@
 %0A%09%09%09%0A%09%09%09
+int 
 LM = (i 
@@ -1877,16 +1877,33 @@
 ) ? 
-300 : 10
+LM2 : LM1;%0A%09%09%09int TM = VM
 ;%0A%09%09
@@ -1928,18 +1928,18 @@
 %09%09%09TM = 
-10
+VM
 ;%0A%09%09%09%0A%09%09
@@ -1971,15 +1971,22 @@
 TM, 
-150, 20
+WLABEL, HLABEL
 );%0A%09
@@ -1993,18 +1993,27 @@
 %09%09TM += 
-30
+HLABEL + VM
 ;%0A%09%09%09tex
@@ -2072,18 +2072,18 @@
 HSIZE + 
-10
+VM
 ;%0A%09%09%09%0A%09%09
@@ -2264,18 +2264,19 @@
 tBounds(
+LM
 1
-0
 , 880, W
@@ -2277,26 +2277,28 @@
 880, WSIZE, 
-40
+HBTN
 );%0A%09%09%09else%0A%09
@@ -2321,19 +2321,19 @@
 tBounds(
-300
+LM2
 , 880, W
@@ -2338,18 +2338,20 @@
  WSIZE, 
-40
+HBTN
 );%0A%09%09%09bu
@@ -2725,17 +2725,17 @@
 xtBoxes%5B
-1
+2
 %5D.setTex
@@ -2757,16 +2757,57 @@
 (text));
+%09//because of the layout 2 comes before 1
 %0A%09%09%09%09%09te
@@ -2806,33 +2806,33 @@
 %0A%09%09%09%09%09textBoxes%5B
-2
+1
 %5D.setText(trans.

Update GUI.java