public UserInterface(){
		final Controller controller= new Controller( this );
		
		UIManager.put( "nimbusBase", new Color( 59, 140, 47 ) );  
	    UIManager.put( "nimbusBlueGrey", new Color( 170, 190, 184 ) );  
	    UIManager.put( "control", new Color( 214, 223, 220 ) ); 
	    
	    try {  
	        for ( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) {  
	            if ( "Nimbus".equals( info.getName() ) ) {  
	                UIManager.setLookAndFeel( info.getClassName() );  
	                break;  
	            }  
	        }  
	    } catch ( UnsupportedLookAndFeelException exc ) {  
	        exc.printStackTrace();  
	    } catch ( ClassNotFoundException exc ) {  
	        exc.printStackTrace();  
	    } catch ( InstantiationException exc ) {  
	        exc.printStackTrace();  
	    } catch ( IllegalAccessException exc ) {  
	        exc.printStackTrace();  
	    }  
	    
		JPanel srcDestJPanel = new JPanel();
		BoxLayout srcDesBoxLayout = new BoxLayout(srcDestJPanel, 0);
		srcDestJPanel.setLayout(srcDesBoxLayout);
		
		JLabel srcJLabel = new JLabel("Sender IP: ");
		JLabel destJLabel = new JLabel("Porta:");
		this.srcJTextField = new JTextField();
		srcJTextField.setText("localhost");
		this.destJTextField = new JTextField(); 
		destJTextField.setText("1024");
		this.connectJButton = new JButton("Connect ");
		this.connectJButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					controller.connectJButtonActionPerformed(evt);
				} catch (NumberFormatException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (UnknownHostException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		});
	 	 
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	 	srcDestJPanel.add(srcJLabel);
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	 	srcDestJPanel.add(this.srcJTextField);
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	 	srcDestJPanel.add(destJLabel);
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	 	srcDestJPanel.add(this.destJTextField);
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	 	srcDestJPanel.add(this.connectJButton);
	 	srcDestJPanel.add(Box.createHorizontalStrut(10));
	  
	 	Dimension srcDestJPanelDimension = new Dimension(650, 25);

	 	srcDestJPanel.setPreferredSize(srcDestJPanelDimension);
	    srcDestJPanel.setMaximumSize(srcDestJPanelDimension);
	    srcDestJPanel.setMinimumSize(srcDestJPanelDimension);
	    
	    Dimension alertaConnectionJPanelDimension = new Dimension(650, 15);
	    
	    
	    JPanel alertaConnectionJPanel = new JPanel();
	    this.conectionJLabel=  new JLabel("aaaaaa");
	    alertaConnectionJPanel.setPreferredSize(alertaConnectionJPanelDimension);
	    alertaConnectionJPanel.setMaximumSize(alertaConnectionJPanelDimension);
	    alertaConnectionJPanel.setMinimumSize(alertaConnectionJPanelDimension);
	    alertaConnectionJPanel.add(Box.createHorizontalStrut(10));
	    alertaConnectionJPanel.add(this.conectionJLabel);
	    
	    JPanel fileChooserJPanel = new JPanel();
	    JLabel selectFileJLabel = new JLabel("Select File: ");
	    this.fileNameJTextField = new JTextField();
	    this.fileNameJTextField.setEditable(false);
	    
	    this.browseSendJButton = new JButton("Browse");
	    this.browseSendJButton.setEnabled(false);
	    this.browseSendJButton.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				controller.browseSendJButtonActionPerformed(evt);
			}
		});
	    
	    BoxLayout fileChooserBoxLayout = new BoxLayout(fileChooserJPanel, 0);
	    fileChooserJPanel.setLayout(fileChooserBoxLayout);
	    fileChooserJPanel.add(Box.createHorizontalStrut(10));
	    fileChooserJPanel.add(selectFileJLabel);
	    fileChooserJPanel.add(Box.createHorizontalStrut(10));
	    fileChooserJPanel.add(this.fileNameJTextField);
	    fileChooserJPanel.add(Box.createHorizontalStrut(10));
	    fileChooserJPanel.add(this.browseSendJButton);
	    fileChooserJPanel.add(Box.createHorizontalStrut(10));
	    fileChooserJPanel.add(Box.createHorizontalStrut(10));
	  
	    fileChooserJPanel.setPreferredSize(srcDestJPanelDimension);
	    fileChooserJPanel.setMaximumSize(srcDestJPanelDimension);
	    fileChooserJPanel.setMinimumSize(srcDestJPanelDimension);
	 
	    JPanel packetInformJPanel = new JPanel();
	    this.timeoutJLabel= new JLabel("Timeout:");;
		this.timeoutJTextFild = new JTextField();
		this.timeoutJTextFild.setEditable(false);
		this.senderWindowSizeJLabel= new JLabel("Sender Window Size");
		this.senderWindowSizeJTextFild= new JTextField();
		this.senderWindowSizeJTextFild.setEditable(false);
		this.receiverWindowSizeJLabel = new JLabel("Receiver Window Size");
		this.receiverWindowSizeJTextFild= new JTextField();
		this.receiverWindowSizeJTextFild.setEditable(false);
	 
	    BoxLayout packetInformBoxLayout = new BoxLayout(packetInformJPanel, 0);
	    packetInformJPanel.setLayout(packetInformBoxLayout);
	    packetInformJPanel.add(Box.createHorizontalStrut(10));
	    packetInformJPanel.add(this.timeoutJLabel);
	    packetInformJPanel.add(Box.createHorizontalStrut(10));
	    packetInformJPanel.add(this.timeoutJTextFild);
	    packetInformJPanel.add(Box.createHorizontalStrut(10));
	    packetInformJPanel.add(this.senderWindowSizeJLabel);
	    packetInformJPanel.add(Box.createHorizontalStrut(10));
	    packetInformJPanel.add(this.senderWindowSizeJTextFild);
	    packetInformJPanel.add(this.receiverWindowSizeJLabel);
	    packetInformJPanel.add(Box.createHorizontalStrut(10));
	    packetInformJPanel.add(this.receiverWindowSizeJTextFild);

	    packetInformJPanel.setPreferredSize(srcDestJPanelDimension);
	    packetInformJPanel.setMaximumSize(srcDestJPanelDimension);
	    packetInformJPanel.setMinimumSize(srcDestJPanelDimension);
	    
	    JPanel packetInform2JPanel = new JPanel();
	    this.speedJLabel= new JLabel("Variation of speed:");;
	 
	    BoxLayout packetInform2BoxLayout = new BoxLayout(packetInform2JPanel, 0);
	    packetInform2JPanel.setLayout(packetInform2BoxLayout);
	    packetInform2JPanel.add(Box.createHorizontalStrut(10));
	    packetInform2JPanel.add(this.speedJLabel);
	    packetInform2JPanel.add(Box.createHorizontalStrut(10));

	    
	    this.sendJButton = new JButton("Send");
	    sendJButton.addActionListener(new ActionListener() {
	    	public void actionPerformed(java.awt.event.ActionEvent evt) {
	    		controller.sendJButtonJButtonActionPerformed(evt);	
	    	}
	    });
	    
	    this.comboBoxSpeed = new JComboBox();
	    packetInform2JPanel.add(comboBoxSpeed);
	    this.comboBoxSpeed.addItem("0%");
	    this.comboBoxSpeed.addItem("10%");
	    this.comboBoxSpeed.addItem("20%");
	    this.comboBoxSpeed.addItem("30%");
	    this.comboBoxSpeed.addItem("40%");
	    this.comboBoxSpeed.addItem("50%");
	    this.comboBoxSpeed.addItem("60%");
	    this.comboBoxSpeed.addItem("70%");
	    this.comboBoxSpeed.addItem("80%");
	    this.comboBoxSpeed.addItem("90%");
	    this.comboBoxSpeed.addItem("100%");
	    this.comboBoxSpeed.setEnabled(false);
	    
	    Component horizontalStrut = Box.createHorizontalStrut(10);
	    packetInform2JPanel.add(horizontalStrut);
	    
	    this.nunberErrorsJLabel = new JLabel("Number of frames with errors:");
	    packetInform2JPanel.add(this.nunberErrorsJLabel);
	    
	    Component horizontalStrut_1 = Box.createHorizontalStrut(10);
	    packetInform2JPanel.add(horizontalStrut_1);
	    
	    this.nunberErrorsJTextField = new JTextField();
	    packetInform2JPanel.add(this.nunberErrorsJTextField);
	    this.nunberErrorsJTextField.setColumns(10);
	    this.nunberErrorsJTextField.setEditable(false);
	    
	    Component horizontalStrut_2 = Box.createHorizontalStrut(10);
	    packetInform2JPanel.add(horizontalStrut_2);
	    packetInform2JPanel.add(this.sendJButton);
	    this.sendJButton.setEnabled(false);
	    packetInform2JPanel.add(Box.createHorizontalStrut(10));
	    
	    packetInform2JPanel.setPreferredSize(srcDestJPanelDimension);
	    packetInform2JPanel.setMaximumSize(srcDestJPanelDimension);
	    packetInform2JPanel.setMinimumSize(srcDestJPanelDimension);
	    
	    Dimension framesReadyPanelDimension = new Dimension(6350, 100);
	    
	    JPanel framesReadyJPanel = new JPanel();
	    BoxLayout framesReadyBoxLayout = new BoxLayout(framesReadyJPanel, 1);
	    framesReadyJPanel.setLayout(framesReadyBoxLayout);
	    
		JLabel framesReadyJLabel = new JLabel("Frames Ready to be sent");
		framesReadyJLabel.setAlignmentX(0.5F);
		this.framesReadyListModel = new DefaultListModel();
		JList framesReadyJList = new JList(this.framesReadyListModel);
	    
	    JScrollPane framesReadyJScrollPane = new JScrollPane(framesReadyJList);
	    framesReadyJScrollPane.setPreferredSize(framesReadyPanelDimension);
	    framesReadyJScrollPane.setMinimumSize(framesReadyPanelDimension);
	    framesReadyJScrollPane.setMaximumSize(framesReadyPanelDimension);
	    
	    framesReadyJPanel.add(framesReadyJLabel);
	    framesReadyJPanel.add(framesReadyJScrollPane);
	    
	    Dimension logJScrollPanelDimension = new Dimension(300, 200);
	    
	    JPanel sendLogJPanel = new JPanel();
	    BoxLayout sendLogBoxLayout = new BoxLayout(sendLogJPanel, 1);
		sendLogJPanel.setLayout(sendLogBoxLayout);

		this.sendSuccessfulJLabel = new JLabel();
		this.receiveSuccessfulJLabel = new JLabel();

		JLabel sendJLabel = new JLabel("Sent");
		sendJLabel.setAlignmentX(0.5F);
		this.sendDefaultListModel = new DefaultListModel();
		JList sendLogJList = new JList(this.sendDefaultListModel);
	  
		JScrollPane sendLogJScrollPane = new JScrollPane(sendLogJList);
		sendLogJScrollPane.setPreferredSize(logJScrollPanelDimension);
	    sendLogJScrollPane.setMinimumSize(logJScrollPanelDimension);
	    sendLogJScrollPane.setMaximumSize(logJScrollPanelDimension);
	    
	    sendLogJPanel.add(sendJLabel);
	 	sendLogJPanel.add(Box.createVerticalStrut(10));
	    sendLogJPanel.add(sendLogJScrollPane);
	 
	    this.sendSuccessfulJLabel.setAlignmentX(0.5F);
	    sendLogJPanel.add(this.sendSuccessfulJLabel);
	 
	    JPanel receiveLogJPanel = new JPanel();
	    BoxLayout receiveLogBoxLayout = new BoxLayout(receiveLogJPanel, 1);
	    receiveLogJPanel.setLayout(receiveLogBoxLayout);
	  
	    JLabel receiveJLabel = new JLabel("Received");
	    receiveJLabel.setAlignmentX(0.5F);
	    this.receiveDefaultListModel = new DefaultListModel();
	    JList receiveLogJList = new JList(this.receiveDefaultListModel);
	  
	    JScrollPane receiveLogJScrollPane = new JScrollPane(receiveLogJList);
	    receiveLogJScrollPane.setPreferredSize(logJScrollPanelDimension);
	    receiveLogJScrollPane.setMinimumSize(logJScrollPanelDimension);
	    receiveLogJScrollPane.setMaximumSize(logJScrollPanelDimension);
	  
	    receiveLogJPanel.add(receiveJLabel);
	    receiveLogJPanel.add(Box.createVerticalStrut(10));
	    receiveLogJPanel.add(receiveLogJScrollPane);
	    this.receiveSuccessfulJLabel.setAlignmentX(0.5F);
	    receiveLogJPanel.add(this.receiveSuccessfulJLabel);
	 
	    Dimension logJPanelDimension = new Dimension(650, 260);
	    JPanel logJPanel = new JPanel();
	    BoxLayout logBoxLayout = new BoxLayout(logJPanel, 0);
	    logJPanel.setLayout(logBoxLayout);
	 
	   	logJPanel.setPreferredSize(logJPanelDimension);
	   	logJPanel.setMinimumSize(logJPanelDimension);
	   	logJPanel.setMaximumSize(logJPanelDimension);
	 
	   	logJPanel.add(sendLogJPanel);
	   	logJPanel.add(Box.createHorizontalStrut(10));
	   	logJPanel.add(receiveLogJPanel);

	   	Dimension receiveTextDimension = new Dimension(650, 100);

	   	JPanel receiveTextJPanel = new JPanel();
	   	BoxLayout receiveTextBoxLayout = new BoxLayout(receiveTextJPanel, 0);
	   	receiveTextJPanel.setLayout(receiveTextBoxLayout);

	   	this.receivedTextJTextArea = new JTextArea();
	   	JScrollPane receivedTextJScrollPane = new JScrollPane(this.receivedTextJTextArea);
	
	   	receiveTextJPanel.add(Box.createHorizontalStrut(10));
	   	receiveTextJPanel.add(receivedTextJScrollPane);
	   	receiveTextJPanel.add(Box.createHorizontalStrut(10));
	
	   	receiveTextJPanel.setPreferredSize(receiveTextDimension);
	   	receiveTextJPanel.setMaximumSize(receiveTextDimension);
	    receiveTextJPanel.setMinimumSize(receiveTextDimension);

	    JPanel receivedPacketsJPanel = new JPanel();
	    BoxLayout receivedPacketsBoxLayout = new BoxLayout(receivedPacketsJPanel, 0);
	    receivedPacketsJPanel.setLayout(receivedPacketsBoxLayout);
	
	    JLabel receivedPacketsJLabel = new JLabel("Received Packets");
 
	    receivedPacketsJLabel.setHorizontalAlignment(2);
	
	    Dimension receivedPacketsDimension = new Dimension(650, 30);
	    receivedPacketsJLabel.setHorizontalTextPosition(4);
	
	    receivedPacketsJPanel.add(Box.createHorizontalStrut(10));
	    receivedPacketsJPanel.add(receivedPacketsJLabel);
	    receivedPacketsJPanel.add(Box.createHorizontalStrut(10));
	
	    receivedPacketsJPanel.setPreferredSize(receivedPacketsDimension);
	    receivedPacketsJPanel.setMinimumSize(receivedPacketsDimension);
	    receivedPacketsJPanel.setMaximumSize(receivedPacketsDimension);
		
	   	JPanel mainJPanel = new JPanel();
	    BoxLayout frameBoxLayout = new BoxLayout(mainJPanel, 1);
	    mainJPanel.setLayout(frameBoxLayout);
	    mainJPanel.add(Box.createVerticalGlue());
	    mainJPanel.add(srcDestJPanel);
	    mainJPanel.add(Box.createVerticalStrut(10));
	    mainJPanel.add(fileChooserJPanel);
	    mainJPanel.add(Box.createVerticalStrut(10));
	    mainJPanel.add(packetInformJPanel);
	    mainJPanel.add(Box.createVerticalStrut(10));
	    mainJPanel.add(packetInform2JPanel);
	    mainJPanel.add(Box.createVerticalStrut(10));
	    mainJPanel.add(framesReadyJPanel);
	    mainJPanel.add(logJPanel);
	    mainJPanel.add(receivedPacketsJPanel);
	    mainJPanel.add(receiveTextJPanel);
	    mainJPanel.add(Box.createVerticalGlue());
	
    	getContentPane().setLayout(new BorderLayout());
	    getContentPane().add(mainJPanel, "Center");
	    setVisible(true);
	    setDefaultCloseOperation(3);
	    setSize(800, 700);
	    setTitle("Client");
	    setLocationRelativeTo(null);
	}