import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/*
 * 
 * CS 177/178 Programming with Multimedia Objects
 * 
 * Created on Nov 10, 2004. 
 *
 * This applet is the GUI for the DNAToProtein applet. 
 * Actions are not associated with any button. A frame contains the widgets.
 * However this is not necessary.  Instead, you may use BorderLayout directly on the applet
 * and avoid the frame. This a matter of choice.
 */

/**
 * @author Aditya Mathur
 *
 */
;

public class DNAToProteinUI extends Applet {
	
	JButton translate=new JButton("Convert");
	JButton done=new JButton("Done");
	
	JTextArea message=new JTextArea(2,20);
	JTextField startPositionInput=new JTextField("Start position=1.", 15);
	JTextArea dnaSequenceInput=new JTextArea ("Type a DNA sequence here", 4, 30);

	JTextArea codonOutput=new JTextArea("Incomplete codons will show an asterisk for each missing letter.", 4, 30);
	

	
	JFrame myFrame=new JFrame("DNA Sequence Tripletizer");
	JPanel p=new JPanel(new GridLayout(2,1));
	
	boolean incompleteSeq; // Indicates if a given DNA sequence is incomplete.
	
	public void init(){
		
	
		codonOutput.setBackground(Color.orange);
		p.setBackground(Color.blue);
		startPositionInput.setBackground(Color.yellow);
		dnaSequenceInput.setBackground(Color.blue);
		dnaSequenceInput.setForeground(Color.yellow);
		
		message.setFont(new Font("SansSerif", Font.BOLD, 20));
		message.setText("Welcome to CS 177 /178 Programming with Multimedia Objects\n");
		message.append("Fall 2004\n");
		message.append("DNA To Protein Converter");
		
		p.setBackground(Color.blue);
		p.add(translate); p.add(done);
		
		this.add(new JTextField("This area is useless."));
		this.add(new JTextField("Close this applet when done"));
		this.setBackground(Color.orange);
		
		// Add panel and widgets to the frame.
		
		myFrame.getContentPane().add(BorderLayout.WEST, p);
		myFrame.getContentPane().add(BorderLayout.NORTH, message);
		myFrame.getContentPane().add(BorderLayout.SOUTH, dnaSequenceInput); 
		myFrame.getContentPane().add(BorderLayout.EAST, startPositionInput);
		myFrame.getContentPane().add(BorderLayout.CENTER,codonOutput);
		
//		 Set some properties of the frame (resizability, color, and size).
		
		myFrame.isResizable(); // Makes the frame resizable.
		myFrame.setBounds(140, 140, 800, 300); // Sets the top left corner coordinbaties to 140, 140 and size to 800x300 pixels.
		
		myFrame.getContentPane().setBackground(Color.orange);
	
		myFrame.show();
		
	}
	
	
	
}// End of applet class.
	
	
  

