public MainWindow() {
		setTitle("AMPA S.A.");
		this.now = this;
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 657, 462);

		JMenuBar menuBar = new JMenuBar();
		setJMenuBar(menuBar);

		JMenu mnAlumno = new JMenu("Alumno");
		menuBar.add(mnAlumno);

		JMenuItem mntmAadirAlumno = new JMenuItem("Añadir alumno");
		mnAlumno.add(mntmAadirAlumno);
		mntmAadirAlumno.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				StudentManagementWindow smw = new StudentManagementWindow(now,
						null);
				smw.setVisible(true);
			}
		});

		JMenu mnActividad = new JMenu("Actividad");
		menuBar.add(mnActividad);

		JMenuItem mntmListarActividades = new JMenuItem("Listar actividades");
		mnActividad.add(mntmListarActividades);
		mntmListarActividades.setName("List Activities");
		mntmListarActividades.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				ListActivitiesWindow law;
				law = new ListActivitiesWindow();
				law.setVisible(true);
			}
		});

		JMenuItem mntmAadirActividad = new JMenuItem("Añadir actividad");
		mnActividad.add(mntmAadirActividad);
		mntmAadirActividad.setName("Create Activity");
		mntmAadirActividad.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				CreateActivityWindow caw;
				caw = new CreateActivityWindow();
				caw.setVisible(true);
			}
		});

		JMenuItem mntmModificarActividad = new JMenuItem("Modificar actividad");
		mnActividad.add(mntmModificarActividad);
		mntmModificarActividad.setName("Update Activity");
		mntmModificarActividad.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				UpdateActivityWindow uaw;
				uaw = new UpdateActivityWindow();
				uaw.setVisible(true);
			}
		});

		JMenuItem mntmBorrarActividad = new JMenuItem("Borrar actividad");
		mnActividad.add(mntmBorrarActividad);
		mntmBorrarActividad.setName("Delete Activity");
		mntmBorrarActividad.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				DeleteActivityWindow daw;
				daw = new DeleteActivityWindow();
				daw.setVisible(true);
			}
		});

		JMenu mnAyuda = new JMenu("Ayuda");
		menuBar.add(mnAyuda);

		JMenuItem mntmAcercaDe = new JMenuItem("Acerca de");
		mnAyuda.add(mntmAcercaDe);
		mntmAcercaDe.setName("About us");
		mntmAcercaDe.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				AboutUsWindow auw;
				auw = new AboutUsWindow();
				auw.setVisible(true);
			}
		});

		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new GridLayout(1, 0, 0, 0));

		JPanel leftPanel = new JPanel();
		contentPane.add(leftPanel);
		leftPanel.setLayout(new BorderLayout(0, 0));

		JScrollPane scrollStudents = new JScrollPane();
		leftPanel.add(scrollStudents);

		studentsTable = new JTable();
		studentsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		studentsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
		studentsTable.setModel(new DefaultTableModel(new Object[][] { { null,
				null, null, null }, }, new String[] { "", "Nombre",
				"Apellidos", "Fecha nacimiento" }) {
			Class[] columnTypes = new Class[] { Object.class, String.class,
					String.class, String.class };

			public Class getColumnClass(int columnIndex) {
				return columnTypes[columnIndex];
			}

			boolean[] columnEditables = new boolean[] { false, false, false,
					false };

			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		studentsTable.getColumnModel().getColumn(0).setPreferredWidth(15);
		studentsTable.getColumnModel().getColumn(0).setMaxWidth(15);
		studentsTable.getColumnModel().getColumn(3).setPreferredWidth(120);
		scrollStudents.setViewportView(studentsTable);

		JButton btnAddStudent = new JButton("Añadir estudiante");
		leftPanel.add(btnAddStudent, BorderLayout.SOUTH);
		btnAddStudent.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				StudentManagementWindow smw = new StudentManagementWindow(now,
						null);
				smw.setVisible(true);
			}
		});

		rigthPanel = new JPanel();
		contentPane.add(rigthPanel);

		JLabel lblHouseHold = new JLabel("Núcleo familiar: ");
		lblHouseHold.setName("lblHouseHold");
		lblHouseHold.setHorizontalTextPosition(SwingConstants.CENTER);
		lblHouseHold.setHorizontalAlignment(SwingConstants.CENTER);
		lblHouseHold.setAlignmentX(Component.CENTER_ALIGNMENT);

		JTabbedPane tabAlumno = new JTabbedPane(JTabbedPane.TOP);

		JButton btnSignUpActivity = new JButton("Apuntarse a actividades");
		btnSignUpActivity.setName("btnSignUpActivity");

		JButton btnReservasComedor = new JButton("Reservas comedor");

		btnReservasComedor.setName("btnCreateBooking");

		JButton btnShowBills = new JButton("Mostrar recibos");
		btnShowBills.setName("btnShowBills");

		JLabel lblLblrepresentative = new JLabel("Representante/s:");
		lblLblrepresentative.setName("lblRepresentative");

		GroupLayout gl_rigthPanel = new GroupLayout(rigthPanel);
		gl_rigthPanel
				.setHorizontalGroup(gl_rigthPanel
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								gl_rigthPanel
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												gl_rigthPanel
														.createParallelGroup(
																Alignment.LEADING)
														.addGroup(
																gl_rigthPanel
																		.createSequentialGroup()
																		.addComponent(
																				lblHouseHold,
																				GroupLayout.DEFAULT_SIZE,
																				286,
																				Short.MAX_VALUE)
																		.addGap(25))
														.addGroup(
																Alignment.TRAILING,
																gl_rigthPanel
																		.createSequentialGroup()
																		.addGroup(
																				gl_rigthPanel
																						.createParallelGroup(
																								Alignment.TRAILING)
																						.addComponent(
																								btnSignUpActivity,
																								Alignment.LEADING,
																								GroupLayout.DEFAULT_SIZE,
																								299,
																								Short.MAX_VALUE)
																						.addComponent(
																								btnReservasComedor,
																								Alignment.LEADING,
																								GroupLayout.DEFAULT_SIZE,
																								299,
																								Short.MAX_VALUE)
																						.addComponent(
																								btnShowBills,
																								Alignment.LEADING,
																								GroupLayout.DEFAULT_SIZE,
																								299,
																								Short.MAX_VALUE))
																		.addContainerGap())
														.addGroup(
																Alignment.TRAILING,
																gl_rigthPanel
																		.createSequentialGroup()
																		.addComponent(
																				tabAlumno,
																				GroupLayout.DEFAULT_SIZE,
																				299,
																				Short.MAX_VALUE)
																		.addContainerGap())
														.addGroup(
																gl_rigthPanel
																		.createSequentialGroup()
																		.addComponent(
																				lblLblrepresentative)
																		.addContainerGap(
																				240,
																				Short.MAX_VALUE)))));
		gl_rigthPanel.setVerticalGroup(gl_rigthPanel.createParallelGroup(
				Alignment.LEADING).addGroup(
				gl_rigthPanel
						.createSequentialGroup()
						.addGap(18)
						.addComponent(lblHouseHold, GroupLayout.PREFERRED_SIZE,
								23, GroupLayout.PREFERRED_SIZE)
						.addGap(18)
						.addComponent(lblLblrepresentative)
						.addGap(13)
						.addComponent(tabAlumno, GroupLayout.DEFAULT_SIZE, 239,
								Short.MAX_VALUE).addGap(18)
						.addComponent(btnSignUpActivity)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnReservasComedor)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(btnShowBills)));

		JPanel explainPanel = new JPanel();
		tabAlumno.addTab("New tab", null, explainPanel, null);
		tabAlumno.setEnabledAt(0, true);

		JLabel lblName = new JLabel("Nombre:");
		lblName.setHorizontalTextPosition(SwingConstants.CENTER);
		lblName.setHorizontalAlignment(SwingConstants.LEFT);

		rigthPanel.setLayout(gl_rigthPanel);

		// Editado

		fillStudentsTable();
		fillRightPanel(rigthPanel);

		studentsTable.getSelectionModel().addListSelectionListener(
				new ListSelectionListener() {
					public void valueChanged(ListSelectionEvent event) {
						fillRightPanel(rigthPanel);

					}
				});
		studentsTable.addMouseListener(new MouseListenerOnlyClick() {

			@Override
			public void mouseClicked(MouseEvent e) {
				if (studentsTable.getSelectedColumn() == 0) {
					int selected = JOptionPane
							.showConfirmDialog(
									null,
									"¿Realmente desea eliminar al estudiante seleccionado?",
									"Borrar estudiante",
									JOptionPane.YES_NO_OPTION,
									JOptionPane.QUESTION_MESSAGE);
					if (selected == 0) {
						Student student = getStudentFromTable();
						student.setDeleted(true);
						try {
							familyService.updateStudent(student);
						} catch (InstanceNotFoundException e1) {
							e1.printStackTrace();
						}
						MainWindow newWindow = new MainWindow();
						newWindow.setVisible(true);
						newWindow.setBounds(now.getBounds());
						now.setVisible(false);
						now.dispose();
					}

				}
			}
		});
	}