|
| 1 | +package giis.demo.tkrun; |
| 2 | + |
| 3 | +import javax.swing.JFrame; |
| 4 | +import net.miginfocom.swing.MigLayout; |
| 5 | +import javax.swing.JLabel; |
| 6 | +import javax.swing.JOptionPane; |
| 7 | +import javax.swing.JTextField; |
| 8 | +import javax.swing.JButton; |
| 9 | + |
| 10 | +import javax.swing.JPanel; |
| 11 | +import java.awt.Font; |
| 12 | +import java.awt.FlowLayout; |
| 13 | +import java.awt.GridLayout; |
| 14 | +import javax.swing.JTextArea; |
| 15 | +import java.awt.Color; |
| 16 | + |
| 17 | +public class CargaView { |
| 18 | + |
| 19 | + private JFrame frmCargaEnvios; |
| 20 | + private JLabel lbTítulo; |
| 21 | + private JButton btnCancelar; |
| 22 | + private JButton btRegistro; |
| 23 | + private JLabel lbID; |
| 24 | + private JTextField tfID; |
| 25 | + private JLabel lbNRef; |
| 26 | + private JTextField tfNRef; |
| 27 | + private JLabel lbUbicacion; |
| 28 | + private JTextField tfUbicacion; |
| 29 | + private JLabel lbFecha; |
| 30 | + |
| 31 | + /** |
| 32 | + * Create the application. |
| 33 | + */ |
| 34 | + public CargaView() { |
| 35 | + initialize(); |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Initialize the contents of the frame. |
| 40 | + */ |
| 41 | + private void initialize() { |
| 42 | + frmCargaEnvios = new JFrame(); |
| 43 | + frmCargaEnvios.getContentPane().setFont(new Font("Tahoma", Font.PLAIN, 13)); |
| 44 | + frmCargaEnvios.setTitle("CargaEnvíos"); |
| 45 | + frmCargaEnvios.setName("CargaEnvíos"); |
| 46 | + frmCargaEnvios.setBounds(0, 0, 366, 231); |
| 47 | + frmCargaEnvios.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); |
| 48 | + frmCargaEnvios.getContentPane().setLayout(new MigLayout("", "[grow]", "[][10.00][][][][][16.00][]")); |
| 49 | + |
| 50 | + lbTítulo = new JLabel("Registro de carga de envíos:"); |
| 51 | + lbTítulo.setFont(new Font("Tahoma", Font.BOLD, 15)); |
| 52 | + frmCargaEnvios.getContentPane().add(lbTítulo, "cell 0 0"); |
| 53 | + |
| 54 | + lbID = new JLabel("ID del transportista: "); |
| 55 | + lbID.setFont(new Font("Tahoma", Font.PLAIN, 13)); |
| 56 | + frmCargaEnvios.getContentPane().add(lbID, "flowx,cell 0 2"); |
| 57 | + |
| 58 | + lbNRef = new JLabel("Número de referencia del envío: "); |
| 59 | + lbNRef.setFont(new Font("Tahoma", Font.PLAIN, 13)); |
| 60 | + frmCargaEnvios.getContentPane().add(lbNRef, "flowx,cell 0 3"); |
| 61 | + |
| 62 | + lbUbicacion = new JLabel("Ubicación de la carga:"); |
| 63 | + lbUbicacion.setFont(new Font("Tahoma", Font.PLAIN, 13)); |
| 64 | + frmCargaEnvios.getContentPane().add(lbUbicacion, "flowx,cell 0 4"); |
| 65 | + |
| 66 | + lbFecha = new JLabel("Se registrará la fecha y hora de la carga (hora actual)"); |
| 67 | + lbFecha.setFont(new Font("Tahoma", Font.PLAIN, 13)); |
| 68 | + frmCargaEnvios.getContentPane().add(lbFecha, "cell 0 5"); |
| 69 | + |
| 70 | + tfID = new JTextField(); |
| 71 | + frmCargaEnvios.getContentPane().add(tfID, "cell 0 2"); |
| 72 | + tfID.setColumns(10); |
| 73 | + |
| 74 | + tfNRef = new JTextField(); |
| 75 | + frmCargaEnvios.getContentPane().add(tfNRef, "cell 0 3"); |
| 76 | + tfNRef.setColumns(10); |
| 77 | + |
| 78 | + tfUbicacion = new JTextField(); |
| 79 | + frmCargaEnvios.getContentPane().add(tfUbicacion, "cell 0 4"); |
| 80 | + tfUbicacion.setColumns(10); |
| 81 | + |
| 82 | + JPanel pnBotones = new JPanel(); |
| 83 | + FlowLayout fl_pnBotones = (FlowLayout) pnBotones.getLayout(); |
| 84 | + fl_pnBotones.setAlignment(FlowLayout.RIGHT); |
| 85 | + frmCargaEnvios.getContentPane().add(pnBotones, "cell 0 7,grow"); |
| 86 | + |
| 87 | + btnCancelar = new JButton("Cancelar"); |
| 88 | + btnCancelar.setForeground(Color.WHITE); |
| 89 | + btnCancelar.setBackground(Color.RED); |
| 90 | + btnCancelar.setFont(new Font("Tahoma", Font.BOLD, 12)); |
| 91 | + pnBotones.add(btnCancelar); |
| 92 | + |
| 93 | + btRegistro = new JButton("Registrar carga"); |
| 94 | + btRegistro.setBackground(Color.GREEN); |
| 95 | + btRegistro.setFont(new Font("Tahoma", Font.BOLD, 12)); |
| 96 | + pnBotones.add(btRegistro); |
| 97 | + } |
| 98 | + |
| 99 | + public void reset() { |
| 100 | + this.tfID.setText(""); |
| 101 | + this.tfNRef.setText(""); |
| 102 | + this.tfUbicacion.setText(""); |
| 103 | + this.getFrame().setVisible(false); |
| 104 | + } |
| 105 | + |
| 106 | + //Getters y Setters anyadidos para acceso desde el controlador (repersentacion compacta) |
| 107 | + public JFrame getFrame() { return this.frmCargaEnvios; } |
| 108 | + public JButton getBtCancelar() { return this.btnCancelar; } |
| 109 | + public JButton getBtRegistrar() { return this.btRegistro; } |
| 110 | + public JTextField getTfID() { return tfID; } |
| 111 | + public JTextField getTfNRef() { return tfNRef; } |
| 112 | + public JTextField getTfUbicacion() { return tfUbicacion; } |
| 113 | +} |
0 commit comments