public  Gui(){
		super("Validador de Codigos de Ident.");
		
		setLayout(new GridBagLayout());
		setMinimumSize(new Dimension(200,100));
		GridBagConstraints c = new GridBagConstraints();
		
	input = new JTextField("Introduce un codigo valido");
	input.selectAll();
	input.addKeyListener(new KeyListener() {
		
		@Override
		public void keyTyped(KeyEvent e) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void keyReleased(KeyEvent e) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void keyPressed(KeyEvent e) {
			switch(e.getKeyCode()) {
			case 27:
				tmp.stop();
				input.setText("");
				break;
			default:
				tmp.stop();
			}
			
		}
	});
		c.fill = GridBagConstraints.HORIZONTAL;
		c.gridx = 0;
		c.gridy = 1;
		c.gridheight=1;
		c.gridwidth=4;
	
	add(input,c);
	
	button = new JButton("Validar");
	button.addActionListener(new ActionListener() {
		
		@Override
		public void actionPerformed(ActionEvent e) {
			
				Nif nif = new Nif(input.getText());
				Cif cif = new Cif(input.getText());
				Nie nie = new Nie(input.getText());
			
				if(nif.isNif()){
					icon.setText("Nif Correcto");
				}else if(cif.isCif()){
					icon.setText("Cif Correcto");
				}else if(nie.isNie()){
					icon.setText("Nie Correcto");
				} 
				else
					icon.setText("Incorrecto");
			
				tmp.start();
				input.requestFocus();
				input.selectAll();
//				t= new Thread(Gui.this);
//				t.start();
		}
	});
	
		
		c.fill = GridBagConstraints.CENTER;
		c.gridx=0;
		c.gridy=2;
		c.gridheight=1;
		c.gridwidth=2;
		
	add(button,c);
	
	
	
	icon = new JLabel("Esperando Code");
	c.fill = GridBagConstraints.CENTER;
		c.gridx=2;
		c.gridy=2;
		c.gridheight=1;
		c.gridwidth=2;
		
	add(icon,c);
	pack();
	tmp = new Timer(30000, this);
	
		
	}