Untitled

 avatar
unknown
plain_text
2 years ago
2.4 kB
2
Indexable
package gui;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JTextField;

import cl.ufro.bd.Usuario;
import utils.ManagerSession;

import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.Font;

public class HomePanel extends Panel {
	
	private JLabel lblNombreHp;
	
	public HomePanel(Principal principal) {
		super(principal);
		setBackground(new Color(183, 183, 255));
		build();
	}

	public void init() {
		setVisible(true);
		Usuario usuario = (Usuario) ManagerSession.findObject("usuario");
		lblNombreHp.setText(usuario.getNombre());
	}

	public void build() {
		JLabel lblNewLabel = new JLabel("Hola");
		lblNewLabel.setFont(new Font("Times New Roman", Font.PLAIN, 24));
		lblNewLabel.setBounds(74, 69, 46, 29);
		add(lblNewLabel);
		
		lblNombreHp = new JLabel("Nombre de usuario");
		lblNombreHp.setFont(new Font("Times New Roman", Font.BOLD, 24));
		lblNombreHp.setBounds(145, 69, 196, 29);
		add(lblNombreHp);
		
		JButton btnSalirHp = new JButton("Salir");
		btnSalirHp.setFont(new Font("Times New Roman", Font.PLAIN, 14));
		btnSalirHp.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				principal.verLoginPanel();
			}
		});
		btnSalirHp.setBounds(123, 421, 150, 31);
		add(btnSalirHp);
		
		JLabel lblNewLabel_1 = new JLabel("¿Qué deseas hacer?");
		lblNewLabel_1.setFont(new Font("Times New Roman", Font.PLAIN, 24));
		lblNewLabel_1.setBounds(105, 262, 188, 29);
		add(lblNewLabel_1);
		
		JButton btnNewButton = new JButton("Búsqueda");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// dirigir al menu de busqueda (donde estaran los filtros antes de mostrar el listado).
				
			}
		});
		btnNewButton.setFont(new Font("Times New Roman", Font.PLAIN, 14));
		btnNewButton.setBounds(123, 330, 150, 31);
		add(btnNewButton);
		
		JButton btnNewButton_1 = new JButton("Crear Publicación");
		btnNewButton_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				// redirige al panel de crear publicacion.
				
			}
		});
		btnNewButton_1.setFont(new Font("Times New Roman", Font.PLAIN, 14));
		btnNewButton_1.setBounds(123, 376, 150, 31);
		add(btnNewButton_1);
		
	}
}
Editor is loading...