Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Sorteo {
- private int id;
- private String codigo;
- private Date fechaInicio;
- private Date fechaFin;
- private String nombre;
- private String descripcion;
- private String hashtag;
- public Sorteo() {
- }
- public Sorteo(int id, String cod, Date fechaIni, Date fechaF, String nom, String desc, String hash) {
- this.id = id;
- this.codigo = cod;
- this.fechaInicio = fechaIni;
- this.fechaFin = fechaF;
- this.nombre = nom;
- this.descripcion = desc;
- this.hashtag = hash;
- }
- public Sorteo(Date fechaIni, Date fechaF, String nom, String hash, String desc) {
- this.fechaInicio = fechaIni;
- this.fechaFin = fechaF;
- this.nombre = nom;
- this.descripcion = desc;
- this.hashtag = hash;
- }
- public Sorteo(String fechaI, String fechaF, String nom, String hash, String desc) throws ParseException {
- DateFormat fecha = new SimpleDateFormat("dd/MM/yyyy");
- DateFormat fecha2 = new SimpleDateFormat("dd/MM/yyyy");
- Date fechaIni = fecha.parse(fechaI);
- Date fechaFin = fecha2.parse(fechaF);
- this.fechaInicio = fechaIni;
- this.fechaFin = fechaFin;
- this.nombre = nom;
- this.descripcion = desc;
- this.hashtag = hash;
- }
- public int id() {
- return this.id;
- }
- public Date fechaInicio() {
- return this.fechaInicio;
- }
- public Date fechaFin() {
- return this.fechaFin;
- }
- public String codigo() {
- return this.codigo;
- }
- public String nombre() {
- return this.nombre;
- }
- public String descripcion() {
- return this.descripcion;
- }
- public String hashtag() {
- return this.hashtag;
- }
- public void setId(int id) {
- this.id = id;
- }
- public void setFechaInicio(Date fecha) {
- this.fechaInicio = fecha;
- }
- public void setFechaFin(Date fecha) {
- this.fechaFin = fecha;
- }
- public void setCodigo(String cod) {
- this.codigo = cod;
- }
- public void setNombre(String nom) {
- this.nombre = nom;
- }
- public void setDescrip(String desc) {
- this.descripcion = desc;
- }
- public void setHashtag(String hash) {
- this.hashtag = hash;
- }
- @Override
- public String toString() {
- return "Sorteo [id=" + id + ", codigo=" + codigo + ", fechaInicio=" + fechaInicio + ", fechaFin=" + fechaFin
- + ", nombre=" + nombre + ", descripcion=" + descripcion + ", hashtag=" + hashtag + "]";
- }
- public class Participante {
- private String nombre;
- private String apellido;
- private int dni;
- private String email;
- public Participante() {
- }
- public Participante(String nom, String ape, int doc, String mail) {
- this.nombre=nom;
- this.apellido=ape;
- this.dni=doc;
- this.email=mail;
- }
- /**Modificadores*/
- public void setNombre(String nom){
- this.nombre=nom;
- }
- public void setApellido(String ape) {
- this.apellido=ape;
- }
- public void setDni(int doc) {
- this.dni=doc;
- }
- public void setEmail(String mail) {
- this.email=mail;
- }
- /**Observadores*/
- public String nombre() {
- return this.nombre;
- }
- public String apellido() {
- return this.apellido;
- }
- public int DNI() {
- return this.dni;
- }
- public String email() {
- return this.email;
- }
- @Override
- public String toString() {
- return "Participante [nombre=" + nombre + ", apellido=" + apellido + ", dni=" + dni + ", email=" + email + "]";
- }
- public class VentanaPrincipal extends JFrame {
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- VentanaPrincipal frame = new VentanaPrincipal();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public VentanaPrincipal() {
- setTitle("Ventana Principal");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 450, 300);
- JMenuBar menuBar = new JMenuBar();
- setJMenuBar(menuBar);
- JMenu mnSorteo = new JMenu("Sorteo");
- menuBar.add(mnSorteo);
- JMenuItem mntmAltamodificacion = new JMenuItem("Alta/Modificacion");
- mntmAltamodificacion.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- AltaSorteo alta = new AltaSorteo();
- alta.setVisible(true);
- }
- });
- mnSorteo.add(mntmAltamodificacion);
- JMenuItem mntmListado = new JMenuItem("Listado");
- mnSorteo.add(mntmListado);
- JMenu mnParticipante = new JMenu("Participante");
- menuBar.add(mnParticipante);
- JMenuItem mntmAltamodificacion_1 = new JMenuItem("Alta/Modificacion");
- mnParticipante.add(mntmAltamodificacion_1);
- JMenuItem mntmListado_1 = new JMenuItem("Listado");
- mnParticipante.add(mntmListado_1);
- }
- private JPanel contentPane;
- private JTextField textField;
- private JTextField textField_1;
- private JTextField textField_2;
- private JTextField textField_3;
- private JTextField textField_4;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- AltaSorteo frame = new AltaSorteo();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public AltaSorteo() {
- setTitle("Alta Sorteo");
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(200, 200, 550, 400);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setLayout(null);
- setContentPane(contentPane);
- textField = new JTextField();
- textField.setBounds(42, 25, 86, 20);
- contentPane.add(textField);
- textField.setColumns(10);
- JLabel lblFechaInicio = new JLabel("Fecha inicio");
- lblFechaInicio.setBounds(42, 11, 94, 14);
- contentPane.add(lblFechaInicio);
- textField_1 = new JTextField();
- textField_1.setBounds(264, 25, 86, 20);
- contentPane.add(textField_1);
- textField_1.setColumns(10);
- JLabel lblFechaFin = new JLabel("Fecha fin");
- lblFechaFin.setBounds(264, 11, 71, 14);
- contentPane.add(lblFechaFin);
- textField_2 = new JTextField();
- textField_2.setBounds(42, 92, 86, 20);
- contentPane.add(textField_2);
- textField_2.setColumns(10);
- JLabel lblNombre = new JLabel("Nombre");
- lblNombre.setBounds(42, 67, 46, 14);
- contentPane.add(lblNombre);
- textField_3 = new JTextField();
- textField_3.setBounds(264, 92, 86, 20);
- contentPane.add(textField_3);
- textField_3.setColumns(10);
- JLabel lblHashtag = new JLabel("Hashtag");
- lblHashtag.setBounds(264, 67, 46, 14);
- contentPane.add(lblHashtag);
- textField_4 = new JTextField();
- textField_4.setBounds(42, 163, 312, 45);
- contentPane.add(textField_4);
- textField_4.setColumns(10);
- JLabel lblDescripcion = new JLabel("Descripcion");
- lblDescripcion.setBounds(42, 138, 104, 14);
- contentPane.add(lblDescripcion);
- JButton btnAceptar = new JButton("Aceptar");
- btnAceptar.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- }
- });
- btnAceptar.setBounds(86, 227, 89, 23);
- contentPane.add(btnAceptar);
- JButton btnCancelar = new JButton("Cancelar");
- btnCancelar.setBounds(261, 227, 89, 23);
- contentPane.add(btnCancelar);
- }
- List<Sorteo> sorteos = new ArrayList<>();
Add Comment
Please, Sign In to add comment