gui interfaz gráfica de usuario

43
“Universidad Nacional José Faustino Sánchez Carrión” pág. 1 FACULTAD: Facultad de Ingeniería E.A.P: Ingeniería de Sistemas CURSO: Lenguaje de Programación TEMA: “Proyecto InkaFarma” PROFESOR: Ing. Juan José Flores Cueto CICLO: III Ciclo TURNO: Mañana Integrantes: Bruno Rocha Maryluz Lissette Chacón Soto Kelly Pichilingue Palomino Rosmery Huacho Perú 18- 08-2009

Upload: maryluz

Post on 13-Mar-2015

394 views

Category:

Documents


3 download

DESCRIPTION

Este es un proyecto usando Netbeans, Empresa utilizada Farmacia InkaFarma

TRANSCRIPT

Page 1: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 1

FACULTAD: Facultad de Ingeniería

E.A.P: Ingeniería de Sistemas

CURSO: Lenguaje de Programación

TEMA: “Proyecto InkaFarma”

PROFESOR: Ing. Juan José Flores Cueto

CICLO: III Ciclo TURNO: Mañana

Integrantes: Bruno Rocha Maryluz Lissette

Chacón Soto Kelly

Pichilingue Palomino Rosmery

Huacho – Perú

18- 08-2009

Page 2: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 2

Introducción

Este presente trabajo titulado “ProyectoInkaFarma” contiene una solución

válida, a un problema de nuestra realidad como es la venta de Productos en

una Farmacia como es la Empresa InkaFarma.

Para la solución del enunciado hemos utilizado los conocimientos aprendidos

en clase, así como también se ha tenido que realizar una investigación de

nuevos conceptos como de GUI (Interfaz Gráfica de Usuario), para que la

presentación del proyecto sea mucho más completa.

Este proyecto tiene como objetivo plantear una solución posible a un problema

que existe en la realidad, esperamos que los conceptos utilizados en este

trabajo sean entendidos para una mejor apreciación.

Integrantes del Grupo

Page 3: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 3

Dedicatoria:

Este presente trabajo está dedicado a

nuestros padres, ya que nos apoyaron en

todo momento en la realización de nuestro

proyecto, también está dedicado al Ing.

Flores Cueto, ya que nos brindo los

conocimientos necesarios para nuestro

proyecto.

Page 4: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 4

Enunciado:

InkaFarma se ubica en el mercado nacional como la primera cadena de boticas. Contando en la

actualidad con diversos puntos de venta en Lima Metropolitana así como también en las principales

ciudades de nuestro territorio.

La Farmacia InkaFarma es una empresa privada formada en 1997 dedicada íntegramente a la

comercialización de los productos de farmacia, artículos de perfumería y tocador, ofreciendo para ello

los más bajos precios así como la más alta calidad y garantía de sus productos y su esmerado servicio

de atención del cliente.

Para ello desean realizar una aplicación con dos opciones de ingreso; los cuales son: el de

Administrador que le va permitir controlar la ventas de sus productos utilizando métodos como:

Agregar, Buscar, Modificar, Eliminar, Ordenar, Calcular y el del Cliente el cual podrá realizar la

compra directamente de los productos.

Utilizando arreglos e implementado con GUI (Interfaz Grafica de Usuario).Validar el ingreso de

Datos.

Grafica de Estructura de Datos:

int numMed=0 int numCliente=0 String listaProd=null double pagoTotal=0 int numProd=0

Page 5: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 5

Donde:

numMed = Permite almacenar el numero de Medicamentos

cod = Código del Medicamento

nom = Nombre del Medicamento

desc = Descripción del Medicamento

unid = Cantidad es Stock

prCost = Precio de Costo del Medicamento

prVent = Precio de Venta del Medicamento

numClientes = Permite almacenar el número de Clientes

utilCliente = Utilidad que genera el cliente

numProd = Permite almacenar el numero de productos que compra el cliente

codProd = Código del producto que el cliente compra

cantProd = Cantidad de Productos que compra el cliente

listaProd = Almacena los productos que el cliente va a comprar

pagoTotal = Pago de cada cliente

Definición de Paquete:

Page 6: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 6

Diagrama de Clases:

Page 7: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 7

Page 8: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 8

Diseño de Interfaz Grafica de Usuario (GUI) :

Page 9: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 9

Codificación:

Código de la Clase Cargador

package inkafarma;

import java.awt.*;

import javax.swing.*;

import org.jvnet.substance.SubstanceLookAndFeel;

public class Cargador extends JFrame implements Runnable{

private JLabel imageLabel1,imageLabel2;

private JLabel jLabel1,jLabel2,jLabel3,jLabel4,jLabel5,jLabel6,jLabel7;

private JProgressBar jProgressBar1;

private JPanel jPanel1;

private ImageIcon icon1,icon2,icon3;

public Cargador(){

skin();

initComponent();

}

private void initComponent() {

jPanel1 = new JPanel();

imageLabel1 = new JLabel();

imageLabel2 = new JLabel();

jLabel1 = new JLabel();

jLabel2 = new JLabel();

jLabel3 = new JLabel();

jLabel4 = new JLabel();

jLabel5 = new JLabel();

jLabel6 = new JLabel();

jLabel7 = new JLabel();

jProgressBar1 = new JProgressBar();

icon1 = new ImageIcon(getClass().getResource("/Imagenes/icon1.png"));

Page 10: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 10

icon2 = new ImageIcon(getClass().getResource("/Imagenes/icon38.png"));

icon3 = new ImageIcon(getClass().getResource("/Imagenes/icon37.png"));

setSize(450,245);

setUndecorated(true);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setTitle("Iniciando Sofware");

setLocationRelativeTo(null);

setVisible(true);

setIconImage(icon1.getImage());

jPanel1.setBorder(BorderFactory.createEtchedBorder(new Color(0, 153, 51), null));

GroupLayout jPanel1Layout = new GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

imageLabel1.setIcon(icon2);

imageLabel1.setBounds(167, 42,450, 200);

imageLabel2.setIcon(icon3);

imageLabel2.setBounds(0, 0,150, 250);

jLabel5.setFont(new Font("Cataneo BT", 1, 24));

jLabel5.setForeground(new Color(0, 153, 0));

jLabel5.setText("InkaFarma");

jLabel5.setBounds(90, 20,150, 20);

jLabel6.setFont(new Font("Cataneo BT", 1, 24));

jLabel6.setForeground(new Color(0, 153, 0));

jLabel6.setText("Software");

jLabel6.setBounds(170, 45,150, 20);

jLabel1.setFont(new Font("Tahoma", 1, 11));

jLabel1.setText("* Chacón Soto , Kelly");

jLabel1.setBounds(90,140, 150,20);

jLabel2.setFont(new Font("Tahoma", 1, 11));

jLabel2.setText("* Pichilingue Palomino ,");

jLabel2.setBounds(90, 160, 200, 20);

jLabel7.setFont(new Font("Tahoma", 1, 11));

jLabel7.setText(" Rosmery");

jLabel7.setBounds(100, 180, 200, 20);

jLabel3.setFont(new Font("Bell MT", 1, 16));

jLabel3.setForeground(new Color(0, 153, 0));

jLabel3.setText("Realizado por :");

jLabel3.setBounds(90,85,150, 20);

jLabel4.setFont(new Font("Tahoma", 1, 11));

jLabel4.setText("* Bruno Rocha , Maryluz");

jLabel4.setBounds(90,120, 150,20);

jProgressBar1.setBounds(285, 10,150, 25);

jPanel1.add(jLabel1);

jPanel1.add(jLabel2);

jPanel1.add(jLabel3);

jPanel1.add(jLabel4);

jPanel1.add(jLabel5);

jPanel1.add(jLabel6);

jPanel1.add(jLabel7);

jPanel1.add(imageLabel1);

jPanel1.add(imageLabel2);

Page 11: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 11

jPanel1.add(jProgressBar1);

jPanel1.setBounds(0,0,450,245);

Container contenedor=this.getContentPane();

contenedor.setLayout(null);

contenedor.add(jPanel1);

}

public void run(){

try{

for(int j=0;j<101;j++){

jProgressBar1.setValue(j);

jProgressBar1.setStringPainted(true);

Thread.sleep(120);

}

new VentanaInkaFarma().setVisible(true);

dispose();

}

catch(InterruptedException ex){}

}

private void skin() {

SubstanceLookAndFeel.setSkin("org.jvnet.substance.skin.AutumnSkin");

SubstanceLookAndFeel.setCurrentTheme("org.jvnet.substance.theme.SubstanceBottleGreenTheme");

SubstanceLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceBubblesWatermark");

JFrame.setDefaultLookAndFeelDecorated(true);

JDialog.setDefaultLookAndFeelDecorated(true);

}

public static void main(String[] args) {

new Thread (new Cargador()).start();

}

}

Código de la Clase VentanaInkaFarma

package inkafarma;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import org.jvnet.substance.SubstanceLookAndFeel;

import org.jvnet.substance.button.StandardButtonShaper;

public class VentanaInkaFarma extends JFrame {

int numMed;

long cod[];

String dat[][];

int unid[];

double precios[][];

int numClientes;

double utilCliente[];

String listaProd;

int numProd;

long codProd[];

int cantProd[];

Page 12: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 12

double pagoTotal;

private JTable jTable1;

private JButton jButton1,jButton2,jButton3,jButton4,jButton5,jButton6,jButton7,jButton8,jButton9;

private JButton jButton10,jButton11,jButton12,jButton13,jButton14,jButton15,jButton16,jButton17;

private JButton jButton18,jButton19,jButton20,jButton21,jButton22,jButton23;

private JLabel imageLabel1,imageLabel2,imageLabel3,imageLabel4,imageLabel5,imageLabel6;

private JLabel imageLabel7,imageLabel8,imageLabel9,imageLabel10,imageLabel11,imageLabel12;

private JLabel imageLabel13,imageLabel14;

private JLabel jLabel1, jLabel2,jLabel3,jLabel4, jLabel5,jLabel6,jLabel7,jLabel8, jLabel9,jLabel10;

private JLabel jLabel11,jLabel12, jLabel13, jLabel14,jLabel15,jLabel16,jLabel17,jLabel18, jLabel19;

private JLabel jLabel20,jLabel21,jLabel22, jLabel23,jLabel24,jLabel25,jLabel26,jLabel27,jLabel28;

private JLabel jLabel29,jLabel30, jLabel31,jLabel32,jLabel33, jLabel34,jLabel35,jLabel36,jLabel37;

private JLabel jLabel38,jLabel39,jLabel40,jLabel41,jLabel42,jLabel43,jLabel44;

private JPanel jPanel1,jPanel2,jPanel3,jPanel4,jPanel5,jPanel6,jPanel7;

private JPasswordField jPasswordField1;

private JScrollPane jScrollPane1,jScrollPane2,jScrollPane3,jScrollPane4;

private JSeparator jSeparator1,jSeparator2,jSeparator3, jSeparator4,jSeparator5,jSeparator6;

private JSeparator jSeparator7, jSeparator8, jSeparator9, jSeparator10, jSeparator11, jSeparator12;

private JSeparator jSeparator13;

private JTabbedPane jTabbedPane1;

private JTextArea jTextArea1,jTextArea2,jTextArea3;

private JTextField jTextField1,jTextField2,jTextField3,jTextField4,jTextField5;

private JTextField jTextField6,jTextField7,jTextField8, jTextField9;

private JTextField jTextField10,jTextField11,jTextField12,jTextField13,jTextField14,jTextField15;

private JTextField jTextField16,jTextField17,jTextField18,jTextField19,jTextField20, jTextField21;

private ImageIcon icon1,icon2,icon3,icon4,icon5,icon6,icon7,icon8,icon9,icon10,icon11,icon12;

private ImageIcon icon13,icon14;

public VentanaInkaFarma() {

numMed=0;

cod = new long[5];

dat=new String [5][2];

unid=new int [5];

precios=new double[5][2];

numClientes=0;

utilCliente=new double[5];

listaProd = "";

numProd=0;

codProd = new long[5];

cantProd = new int[5];

pagoTotal=0;

initComponents();

}

private void initComponents() {

jButton1 = new JButton();

jButton2 = new JButton();

jButton3 = new JButton();

jButton4 = new JButton();

jButton5 = new JButton();

jButton6 = new JButton();

jButton7 = new JButton();

jButton8 = new JButton();

jButton9 = new JButton();

Page 13: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 13

jButton10 = new JButton();

jButton11 = new JButton();

jButton12 = new JButton();

jButton13 = new JButton();

jButton14 = new JButton();

jButton15 = new JButton();

jButton16 = new JButton();

jButton17 = new JButton();

jButton18 = new JButton();

jButton19 = new JButton();

jButton20 = new JButton();

jButton21 = new JButton();

jButton22 = new JButton();

jButton23 = new JButton();

jLabel1 = new JLabel();

jLabel2 = new JLabel();

jLabel3 = new JLabel();

jLabel4 = new JLabel();

jLabel5 = new JLabel();

jLabel6 = new JLabel();

jLabel7 = new JLabel();

jLabel8 = new JLabel();

jLabel9 = new JLabel();

jLabel10 = new JLabel();

jLabel11 = new JLabel();

jLabel12 = new JLabel();

jLabel13 = new JLabel();

jLabel14 = new JLabel();

jLabel15 = new JLabel();

jLabel16 = new JLabel();

jLabel17 = new JLabel();

jLabel18 = new JLabel();

jLabel19 = new JLabel();

jLabel20 = new JLabel();

jLabel21 = new JLabel();

jLabel22 = new JLabel();

jLabel23 = new JLabel();

jLabel24 = new JLabel();

jLabel25 = new JLabel();

jLabel26 = new JLabel();

jLabel27 = new JLabel();

jLabel28 = new JLabel();

jLabel29 = new JLabel();

jLabel30 = new JLabel();

jLabel31 = new JLabel();

jLabel32 = new JLabel();

jLabel33 = new JLabel();

jLabel34 = new JLabel();

jLabel35 = new JLabel();

jLabel36 = new JLabel();

jLabel37 = new JLabel();

jLabel38 = new JLabel();

jLabel39 = new JLabel();

jLabel40 = new JLabel();

jLabel41 = new JLabel();

jLabel42 = new JLabel();

jLabel43 = new JLabel();

jLabel44 = new JLabel();

jPanel1 = new JPanel();

jPanel2 = new JPanel();

Page 14: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 14

jPanel3 = new JPanel();

jPanel4 = new JPanel();

jPanel5 = new JPanel();

jPanel6 = new JPanel();

jPanel7 = new JPanel();

jPasswordField1 =new JPasswordField();

jScrollPane1 = new JScrollPane();

jScrollPane2 = new JScrollPane();

jScrollPane3 = new JScrollPane();

jScrollPane4 = new JScrollPane();

jSeparator1 = new JSeparator();

jSeparator2 = new JSeparator();

jSeparator3 = new JSeparator();

jSeparator4 = new JSeparator();

jSeparator5 = new JSeparator();

jSeparator6 = new JSeparator();

jSeparator7 = new JSeparator();

jSeparator8 = new JSeparator();

jSeparator9 = new JSeparator();

jSeparator10 = new JSeparator();

jSeparator11 = new JSeparator();

jSeparator12 = new JSeparator();

jSeparator13 = new JSeparator();

jTabbedPane1 = new JTabbedPane();

jTextArea1 = new JTextArea();

jTextArea2 = new JTextArea();

jTextArea3 = new JTextArea();

jTextField1 = new JTextField();

jTextField2 = new JTextField();

jTextField3 = new JTextField();

jTextField4 = new JTextField();

jTextField5 = new JTextField();

jTextField6 = new JTextField();

jTextField7 = new JTextField();

jTextField8 = new JTextField();

jTextField9 = new JTextField();

jTextField10 = new JTextField();

jTextField11 = new JTextField();

jTextField12 = new JTextField();

jTextField13 = new JTextField();

jTextField14 = new JTextField();

jTextField15 = new JTextField();

jTextField16 = new JTextField();

jTextField17 = new JTextField();

jTextField18 = new JTextField();

jTextField19 = new JTextField();

jTextField20 = new JTextField();

jTextField21 = new JTextField();

imageLabel1 = new JLabel();

imageLabel2 = new JLabel();

imageLabel3 = new JLabel();

imageLabel4 = new JLabel();

imageLabel5 = new JLabel();

imageLabel6 = new JLabel();

imageLabel7 = new JLabel();

Page 15: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 15

imageLabel8 = new JLabel();

imageLabel9 = new JLabel();

imageLabel10 = new JLabel();

imageLabel11 = new JLabel();

imageLabel12 = new JLabel();

imageLabel13 = new JLabel();

imageLabel14 = new JLabel();

icon1 = new ImageIcon(getClass().getResource("/Imagenes/icon1.png"));

icon2 = new ImageIcon(getClass().getResource("/Imagenes/icon2.png"));

icon3 = new ImageIcon(getClass().getResource("/Imagenes/icon3.png"));

icon4 = new ImageIcon(getClass().getResource("/Imagenes/icon40.png"));

icon5 = new ImageIcon(getClass().getResource("/Imagenes/icon4.png"));

icon6 = new ImageIcon(getClass().getResource("/Imagenes/icon21.png"));

icon7 = new ImageIcon(getClass().getResource("/Imagenes/icon41.png"));

icon8 = new ImageIcon(getClass().getResource("/Imagenes/icon23.png"));

icon9 = new ImageIcon(getClass().getResource("/Imagenes/icon31.png"));

icon10 = new ImageIcon(getClass().getResource("/Imagenes/icon32.png"));

icon11 = new ImageIcon(getClass().getResource("/Imagenes/icon33.gif"));

icon12 = new ImageIcon(getClass().getResource("/Imagenes/icon34.png"));

icon13 = new ImageIcon(getClass().getResource("/Imagenes/icon43.png"));

icon14 = new ImageIcon(getClass().getResource("/Imagenes/icon45.png"));

setTitle("InkaFarma Software");

setSize(726, 515);

setLocationRelativeTo(null);

setResizable(false);

setDefaultCloseOperation(EXIT_ON_CLOSE);

setIconImage(icon1.getImage());

diseñoPanel1();

GroupLayout jPanel1Layout = new GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

diseñoPanel2();

GroupLayout jPanel2Layout = new GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);

diseñoPanel3();

GroupLayout jPanel3Layout = new GroupLayout(jPanel3);

jPanel3.setLayout(jPanel3Layout);

diseñoPanel4();

GroupLayout jPanel4Layout = new GroupLayout(jPanel4);

jPanel4.setLayout(jPanel4Layout);

diseñoPanel5();

GroupLayout jPanel5Layout = new GroupLayout(jPanel5);

jPanel5.setLayout(jPanel5Layout);

diseñoPanel6();

GroupLayout jPanel6Layout = new GroupLayout(jPanel6);

jPanel6.setLayout(jPanel6Layout);

diseñoPanel7();

GroupLayout jPanel7Layout = new GroupLayout(jPanel7);

jPanel7.setLayout(jPanel7Layout);

jTabbedPane1.addTab("Bienvenido",jPanel1);

jTabbedPane1.addTab("Agregar",jPanel2);

jTabbedPane1.addTab("Buscar / Modificar",jPanel3);

jTabbedPane1.addTab("Eliminar Producto",jPanel7);

Page 16: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 16

jTabbedPane1.addTab("Lista de Productos",jPanel4);

jTabbedPane1.addTab("Comprar",jPanel5);

jTabbedPane1.addTab("Información General",jPanel6);

jTabbedPane1.setFont(new Font("Arial", 0, 12));

jTabbedPane1.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jTabbedPane1.setBounds(10, 10,698, 465);

Container contenedor=this.getContentPane();

contenedor.setLayout(null);

contenedor.add(jTabbedPane1);

}

private void diseñoPanel1() {

imageLabel1.setIcon(icon2);

imageLabel1.setBounds(420,120, 30, 30);

imageLabel2.setIcon(icon4);

imageLabel2.setBounds(110,260,350, 150);

imageLabel13.setIcon(icon13);

imageLabel13.setBounds(135,120,350, 150);

imageLabel12.setIcon(icon7);

imageLabel12.setBounds(185,80,150, 50);

jLabel1.setFont(new Font("Bell MT", 1, 18));

jLabel1.setForeground(new Color(0, 153, 51));

jLabel1.setText("Administrador :");

jLabel1.setBounds(450,80, 150, 25);

jLabel2.setText("Ingresar Clave :");

jLabel2.setBounds(460,125, 150, 25);

jPasswordField1.setBounds(550,125,100,20);

jButton1.setText("Activar");

jButton1.setBounds(450,165,90, 25);

jButton1.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton1.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

Activar();

}

});

jButton2.setText("Desactivar");

jButton2.setBounds(550, 165, 90,25);

jButton2.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton2.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

Desactivar();

}

});

imageLabel8.setIcon(icon9);

imageLabel8.setBounds(0, 120, 160, 330);

imageLabel9.setIcon(icon10);

Page 17: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 17

imageLabel9.setBounds(350, 195, 350, 250);

imageLabel10.setIcon(icon11);

imageLabel10.setBounds(520, 28,150, 20);

imageLabel11.setIcon(icon12);

imageLabel11.setBounds(0, 0,700, 70);

jPanel1.add(imageLabel1);

jPanel1.add(imageLabel2);

jPanel1.add(jLabel1);

jPanel1.add(jLabel2);

jPanel1.add(jPasswordField1);

jPanel1.add(jButton1);

jPanel1.add(jButton2);

jPanel1.add(imageLabel8);

jPanel1.add(imageLabel9);

jPanel1.add(imageLabel10);

jPanel1.add(imageLabel11);

jPanel1.add(imageLabel12);

jPanel1.add(imageLabel13);

}

private void diseñoPanel2() {

jLabel3.setFont(new Font("Bell MT", 1, 18));

jLabel3.setForeground(new Color(0, 153, 51));

jLabel3.setText("Descripción del Producto :");

jLabel3.setBounds(30, 25, 250, 25);

jLabel4.setText("Codigo :");

jLabel4.setBounds(30, 70, 250, 20);

jTextField1.setBounds(130,70,100,20);

jTextField1.setEditable(false);

jButton3.setText("Verificar");

jButton3.setEnabled(false);

jButton3.setBounds(240, 68,90,25);

jButton3.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

Verificar();

}

});

jLabel5.setText("Nombre :");

jLabel5.setBounds(30, 110, 250, 20);

jTextField2.setBounds(130,110,200,20);

jTextField2.setEditable(false);

jLabel6.setText("Descripción :");

jLabel6.setBounds(30, 150, 250, 25);

jTextField19.setEditable(false);

jTextField19.setBounds(130, 150, 200, 20);

jSeparator1.setBounds(10, 200, 340, 10);

imageLabel3.setIcon(icon3);

imageLabel3.setBounds(370, 25,300,200);

jLabel7.setFont(new Font("Bell MT", 1, 18));

Page 18: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 18

jLabel7.setForeground(new Color(0, 153, 51));

jLabel7.setText("Cantidad en Stock :");

jLabel7.setBounds(30, 225, 250, 25);

jLabel8.setText("Número de Unidades :");

jLabel8.setBounds(30, 275, 250, 20);

jTextField3.setBounds(180,275,150,20);

jTextField3.setEditable(false);

imageLabel4.setIcon(icon5);

imageLabel4.setBounds(45, 265,300,200);

jLabel9.setFont(new Font("Bell MT", 1, 18));

jLabel9.setForeground(new Color(0, 153, 51));

jLabel9.setText("Precios de Venta y Costo :");

jLabel9.setBounds(400,250,250,25);

jLabel10.setText("Precio de Costo :");

jLabel10.setBounds(400, 295, 150,20);

jTextField4.setBounds(530,295,130,20);

jTextField4.setEditable(false);

jLabel11.setText("Precio de venta :");

jLabel11.setBounds(400, 335, 150,20);

jTextField5.setBounds(530,335,130,20);

jTextField5.setEditable(false);

jButton4.setText("Agregar");

jButton4.setEnabled(false);

jButton4.setBounds(550, 380,100,25);

jButton4.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton4.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

Agregar();

}

});

jPanel2.add(jButton3);

jPanel2.add(jButton4);

jPanel2.add(jSeparator1);

jPanel2.add(jLabel3);

jPanel2.add(jLabel4);

jPanel2.add(jLabel5);

jPanel2.add(jLabel6);

jPanel2.add(jLabel7);

jPanel2.add(jLabel8);

jPanel2.add(jLabel9);

jPanel2.add(jLabel10);

jPanel2.add(jLabel11);

jPanel2.add(imageLabel3);

jPanel2.add(imageLabel4);

jPanel2.add(jTextField19);

jPanel2.add(jTextField1);

jPanel2.add(jTextField2);

jPanel2.add(jTextField3);

jPanel2.add(jTextField4);

jPanel2.add(jTextField5);

}

private void diseñoPanel3() {

Page 19: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 19

jLabel12.setFont(new Font("Bell MT", 1, 18));

jLabel12.setForeground(new Color(0, 153, 51));

jLabel12.setText("Buscar :");

jLabel12.setBounds(30, 30, 250, 25);

jLabel13.setText("Codigo :");

jLabel13.setBounds(30, 70, 250, 20);

jTextField6.setBounds(130,70,100,20);

jTextField6.setEditable(false);

jButton5.setText("Buscar");

jButton5.setEnabled(false);

jButton5.setBounds(250, 68,80,25);

jButton5.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton5.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

BuscarParaModificar();

}

});

jSeparator10.setBounds(20, 110, 320, 10);

imageLabel5.setIcon(icon6);

imageLabel5.setBounds(80, 150,200,250);

jLabel14.setFont(new Font("Bell MT", 1, 18));

jLabel14.setForeground(new Color(0, 153, 51));

jLabel14.setText("Resultado de la Busqueda :");

jLabel14.setBounds(380, 30, 250, 25);

jLabel15.setFont(new Font("Tahoma", 1, 11));

jLabel15.setText("Presione si sus datos tienen algún error!!");

jLabel15.setBounds(380, 65, 250, 25);

jButton6.setToolTipText("Activar");

jButton6.setEnabled(false);

jButton6.setBounds(620,65,40,20);

jButton6.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton6.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

ActivarDesactivar3(true);

}

});

jLabel16.setText("Nombre :");

jLabel16.setBounds(380, 110, 230, 20);

jTextField7.setBounds(470,110,190,20);

jTextField7.setEditable(false);

jLabel17.setText("Descripción :");

jLabel17.setBounds(380, 150, 230, 25);

jTextField20.setBounds(470, 150,190, 20);

jTextField20.setEditable(false);

jSeparator2.setBounds(370, 200, 300, 10);

jLabel18.setText("Número de Unidades :");

jLabel18.setBounds(380, 230, 230, 20);

jTextField8.setBounds(510,230,150,20);

jTextField8.setEditable(false);

Page 20: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 20

jSeparator3.setBounds(370, 265, 300, 10);

jLabel19.setText("Precio de Costo :");

jLabel19.setBounds(380, 285, 150,20);

jTextField9.setBounds(510,285,150,20);

jTextField9.setEditable(false);

jLabel20.setText("Precio de venta :");

jLabel20.setBounds(380, 325, 150,20);

jTextField10.setBounds(510,325,150,20);

jTextField10.setEditable(false);

jSeparator4.setBounds(370, 360, 300, 10);

jButton7.setText("Modificar");

jButton7.setEnabled(false);

jButton7.setBounds(480, 390,100,25);

jButton7.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton7.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

Modificar();

}

});

jPanel3.add(jButton5);

jPanel3.add(jButton6);

jPanel3.add(jButton7);

jPanel3.add(jSeparator2);

jPanel3.add(jSeparator3);

jPanel3.add(jSeparator4);

jPanel3.add(jSeparator10);

jPanel3.add(jLabel12);

jPanel3.add(jLabel13);

jPanel3.add(jLabel14);

jPanel3.add(jLabel15);

jPanel3.add(jLabel16);

jPanel3.add(jLabel17);

jPanel3.add(jLabel18);

jPanel3.add(jLabel19);

jPanel3.add(jLabel20);

jPanel3.add(imageLabel5);

jPanel3.add(jTextField20);

jPanel3.add(jTextField6);

jPanel3.add(jTextField7);

jPanel3.add(jTextField8);

jPanel3.add(jTextField9);

jPanel3.add(jTextField10);

}

private void diseñoPanel4() {

jLabel32.setFont(new Font("Bell MT", 1, 18));

jLabel32.setForeground(new Color(0, 153, 51));

jLabel32.setText("Visualizar Productos :");

jLabel32.setBounds(40,25, 200, 25);

jLabel33.setFont(new Font("Tahoma", 1, 11));

jLabel33.setText("Listar Productos Ordenados por :");

jLabel33.setBounds(40,60, 200, 25);

jButton13.setText("Codigo");

Page 21: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 21

jButton13.setBounds(70,110,90, 25);

jButton13.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton13.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

OrdenarCod();

}

});

jButton14.setText("Nombre");

jButton14.setBounds(70,165,90, 25);

jButton14.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton14.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

OrdenarNom();

}

});

jButton15.setText("Descripción");

jButton15.setBounds(70, 225, 90,25);

jButton15.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton15.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

OrdenarDesc();

}

});

jButton16.setText("Cantidad");

jButton16.setBounds(70, 285, 90,25);

jButton16.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton16.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

OrdenarCant();

}

});

jButton18.setText("Precio");

jButton18.setBounds(70, 345, 90,25);

jButton18.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton18.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

OrdenarPrec();

}

});

jTable1 = new JTable();

jScrollPane4 = new JScrollPane(jTable1);

jScrollPane4.setBounds(230, 100,420, 300);

jPanel4.add(jLabel32);

jPanel4.add(jLabel33);

jPanel4.add(jButton13);

jPanel4.add(jButton14);

jPanel4.add(jButton15);

jPanel4.add(jButton16);

jPanel4.add(jButton18);

jPanel4.add(jScrollPane4);

}

Page 22: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 22

private void diseñoPanel5() {

jLabel21.setFont(new Font("Bell MT", 1, 18));

jLabel21.setForeground(new Color(0, 153, 51));

jLabel21.setText("Buscar");

jLabel21.setBounds(30,20,100, 20);

jLabel22.setText("Codigo del Producto :");

jLabel22.setBounds(30,50, 160, 20);

jTextField11.setBounds(150,50, 100,20);

jButton8.setText("Buscar");

jButton8.setBounds(285, 48, 80, 25);

jButton8.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton8.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

BuscarMostrarDatos();

}

});

jSeparator5.setBounds(20,90,380, 10);

jLabel23.setText("Nombre :");

jLabel23.setBounds(30,110, 170, 20);

jTextField12.setBounds(150,110, 230,20);

jTextField12.setEditable(false);

jLabel24.setText("Codigo :");

jLabel24.setBounds(30, 140, 150, 20);

jTextField13.setBounds(150,140, 100,20);

jTextField13.setEditable(false);

jLabel25.setText("Nº de Unidades :");

jLabel25.setBounds(30, 170, 150, 20);

jTextField14.setBounds(150,170, 100,20);

jTextField14.setEditable(false);

jLabel26.setText("Precio x Unid. :");

jLabel26.setBounds(30, 200, 150, 20);

jTextField15.setBounds(150,200, 100,20);

jTextField15.setEditable(false);

imageLabel6.setIcon(icon1);

imageLabel6.setBounds(280, 133,100, 100);

jSeparator6.setBounds(20, 230,380, 10);

jLabel27.setFont(new Font("Bell MT", 1, 18));

jLabel27.setForeground(new Color(0, 153, 51));

jLabel27.setText("Realizar Compra :");

jLabel27.setBounds(30, 250, 200, 20);

jLabel28.setText("Cantidad :");

jLabel28.setBounds(30, 290, 150, 20);

jTextField16.setBounds(150,290, 100,20);

jButton9.setText("Calcular");

jButton9.setBounds(285,285, 90, 25);

jButton9.setEnabled(false);

jButton9.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton9.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

CalcularSubTotal();

Page 23: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 23

}

});

jSeparator7.setBounds(20, 320,250, 10);

jLabel29.setText("Sub Total :");

jLabel29.setBounds(30, 340, 150, 20);

jTextField17.setBounds(150,340, 100,20);

jTextField17.setEditable(false);

jButton10.setText("Agregar a la Lista");

jButton10.setBounds(270,338, 130, 27);

jButton10.setEnabled(false);

jButton10.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton10.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

AgregarListaProducto1();

}

});

jSeparator8.setBounds(20, 370,250, 10);

jLabel30.setText("Total a Pagar :");

jLabel30.setBounds(30, 390, 150, 20);

jTextField18.setBounds(150,390, 100,20);

jTextField18.setEditable(false);

jButton11.setText("Otro Producto");

jButton11.setBounds(280,387, 105, 25);

jButton11.setEnabled(false);

jButton11.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton11.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

OtroProducto();

}

});

jLabel31.setFont(new Font("Tahoma", 1, 11));

jLabel31.setText("Productos que va Comprar :");

jLabel31.setBounds(420, 30, 200, 20);

jTextArea3.setEnabled(false);

jScrollPane3.setViewportView(jTextArea3);

jScrollPane3.setBounds(420, 70, 250, 300);

jButton12.setText("Comprar");

jButton12.setBounds(590,30, 80, 25);

jButton12.setEnabled(false);

jButton12.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton12.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

DatosDelRecibo();

}

});

jButton17.setText("Nueva Compra");

jButton17.setBounds(500,390, 100, 25);

jButton17.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

Page 24: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 24

jButton17.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

ReiniciarCompra();

}

});

jPanel5.add(jLabel21);

jPanel5.add(jLabel22);

jPanel5.add(jLabel23);

jPanel5.add(jLabel24);

jPanel5.add(jLabel25);

jPanel5.add(jLabel26);

jPanel5.add(jLabel27);

jPanel5.add(jLabel28);

jPanel5.add(jLabel29);

jPanel5.add(jLabel30);

jPanel5.add(jLabel31);

jPanel5.add(jButton8);

jPanel5.add(jButton9);

jPanel5.add(jButton10);

jPanel5.add(jButton11);

jPanel5.add(jButton12);

jPanel5.add(jButton17);

jPanel5.add(imageLabel6);

jPanel5.add(jTextField11);

jPanel5.add(jTextField12);

jPanel5.add(jTextField13);

jPanel5.add(jTextField14);

jPanel5.add(jTextField15);

jPanel5.add(jTextField16);

jPanel5.add(jTextField17);

jPanel5.add(jTextField18);

jPanel5.add(jSeparator5);

jPanel5.add(jSeparator6);

jPanel5.add(jSeparator7);

jPanel5.add(jSeparator8);

jPanel5.add(jSeparator9);

jPanel5.add(jScrollPane3);

}

private void diseñoPanel6() {

jLabel34.setFont(new Font("Bell MT", 1, 18));

jLabel34.setForeground(new Color(0, 153, 51));

jLabel34.setText("Ventas :");

jLabel34.setBounds(40,25, 100, 25);

jLabel35.setFont(new Font("Tahoma", 1, 11));

jLabel35.setText("Reporte de las Ventas del Día .");

jLabel35.setBounds(40,60, 200, 20);

jButton19.setText("Ventas");

jButton19.setEnabled(false);

jButton19.setBounds(80, 100, 90,25);

jButton19.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton19.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

Ventas();

}

});

Page 25: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 25

jSeparator11.setBounds(20,140,220, 10);

jLabel36.setFont(new Font("Bell MT", 1, 18));

jLabel36.setForeground(new Color(0, 153, 51));

jLabel36.setText("Utilidad :");

jLabel36.setBounds(40,160,100, 25);

jLabel37.setFont(new Font("Tahoma", 1, 11));

jLabel37.setText("Calcula y Muestra la Utilidad");

jLabel37.setBounds(40,195, 200, 20);

jLabel38.setFont(new Font("Tahoma", 1, 11));

jLabel38.setText("generada .");

jLabel38.setBounds(40,215, 200, 20);

jButton20.setText("Calcular");

jButton20.setEnabled(false);

jButton20.setBounds(80, 260, 90,25);

jButton20.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton20.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

CalcularUtilTotal();

}

});

jSeparator12.setBounds(20,295,220, 10);

jLabel39.setFont(new Font("Bell MT", 1, 18));

jLabel39.setForeground(new Color(0, 153, 51));

jLabel39.setText("Productos Agotados :");

jLabel39.setBounds(40,315, 200, 25);

jLabel40.setFont(new Font("Tahoma", 1, 11));

jLabel40.setText("Lista todos los Productos que tienen pocas");

jLabel40.setBounds(40,350, 250, 20);

jLabel41.setFont(new Font("Tahoma", 1, 11));

jLabel41.setText("unidades para vender o ya se agotaron .");

jLabel41.setBounds(40,370, 250, 20);

jButton21.setText("Mostrar");

jButton21.setEnabled(false);

jButton21.setBounds(335, 355, 90,25);

jButton21.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton21.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent evt){

Mostrar();

}

});

jTextArea1.setEnabled(false);

jTextArea1.setFont(new Font("Arial Unicode MS", 1, 12));

jScrollPane1 = new JScrollPane(jTextArea1);

jScrollPane1.setBounds(260, 30,410, 265);

imageLabel7.setIcon(icon8);

imageLabel7.setBounds(455,325,350, 80);

jPanel6.add(jLabel34);

jPanel6.add(jLabel35);

Page 26: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 26

jPanel6.add(jLabel36);

jPanel6.add(jLabel37);

jPanel6.add(jLabel38);

jPanel6.add(jLabel39);

jPanel6.add(jLabel40);

jPanel6.add(jLabel41);

jPanel6.add(jButton19);

jPanel6.add(jButton20);

jPanel6.add(jButton21);

jPanel6.add(imageLabel7);

jPanel6.add(jSeparator11);

jPanel6.add(jSeparator12);

jPanel6.add(jScrollPane1);

}

private void diseñoPanel7(){

jLabel42.setFont(new Font("Bell MT", 1, 18));

jLabel42.setForeground(new Color(0, 153, 51));

jLabel42.setText("Eliminar:");

jLabel42.setBounds(30, 30, 250, 25);

jLabel43.setText("Codigo :");

jLabel43.setBounds(30, 70, 250, 20);

jTextField21.setBounds(130,70,100,20);

jTextField21.setEditable(false);

jButton22.setText("Buscar");

jButton22.setEnabled(false);

jButton22.setBounds(250, 68,80,25);

jButton22.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton22.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

BuscarParaEliminar();

}

});

jSeparator13.setBounds(15, 110, 340, 10);

imageLabel14.setIcon(icon14);

imageLabel14.setBounds(80,140,450, 250);

jLabel44.setFont(new Font("Tahoma", 1, 11));

jLabel44.setText("Resultado de la Busqueda :");

jLabel44.setBounds(410, 30, 250, 20);

jTextArea2.setEnabled(false);

jTextArea2.setFont(new Font("Arial Unicode MS", 1, 12));

jScrollPane2.setViewportView(jTextArea2);

jScrollPane2.setBounds(410, 70, 250, 300);

jButton23.setText("Eliminar");

jButton23.setEnabled(false);

jButton23.setBounds(490,390,80,25);

jButton23.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton23.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

Eliminar();

}

});

Page 27: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 27

jPanel7.add(jLabel42);

jPanel7.add(jLabel43);

jPanel7.add(jLabel44);

jPanel7.add(jButton22);

jPanel7.add(imageLabel14);

jPanel7.add(jScrollPane2);

jPanel7.add(jTextField21);

jPanel7.add(jButton23);

jPanel7.add(jSeparator13);

}

/**

* Activar las Opciones del Administrador

*/

private void Activar() {

if(jPasswordField1.getText().compareTo("123")==0){

JOptionPane.showMessageDialog(null,"Se han habilitado las \nOpciones del Administrador","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

ActivarDesactivar1(true);

}else{

JOptionPane.showMessageDialog(null,"La Clave ingresada no es la correcta\nVerifique...!!","Error",

JOptionPane.ERROR_MESSAGE);

}

}

private void ActivarDesactivar1(boolean siNo) {

jTextField21.setEditable(siNo);

jTextField1.setEditable(siNo);

jButton3.setEnabled(siNo);

jTextField6.setEditable(siNo);

jButton5.setEnabled(siNo);

jButton22.setEnabled(siNo);

jButton21.setEnabled(siNo);

jButton20.setEnabled(siNo);

jButton19.setEnabled(siNo);

}

/**

* Desactiva las Opciones del Administrador

*/

private void Desactivar() {

ActivarDesactivar1(false);

jPasswordField1.setText("");

}

/**

* Verifica si el Codigo ya Existe

*/

private void Verificar() {

if(BuscarCod(Long.parseLong(jTextField1.getText()))!=-1){

ActivarDesactivar2(true);

}else{

JOptionPane.showMessageDialog(null,"El codigo ingresado ya Existe \nVerifique ... !!","Error",

JOptionPane.ERROR_MESSAGE);

}

}

Page 28: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 28

private int BuscarCod(long codigo){

for(int i=0;i<numMed;i++)

{

if(cod[i]==codigo){

return -1;

}

}return 1;

}

private void ActivarDesactivar2(boolean siNo) {

jTextField2.setEditable(siNo);

jTextField3.setEditable(siNo);

jTextField4.setEditable(siNo);

jTextField5.setEditable(siNo);

jTextField19.setEditable(siNo);

jButton4.setEnabled(siNo);

}

/**

* Agregar un Producto

*/

private void Agregar() {

if(numMed==cod.length){

Aumentar();

}

cod[numMed]=Long.parseLong(jTextField1.getText().trim());

dat[numMed][0]=jTextField2.getText().trim();

dat[numMed][1]=jTextField19.getText().trim();

unid[numMed]=Integer.parseInt(jTextField3.getText().trim());

precios[numMed][0]=Double.parseDouble(jTextField4.getText().trim());

precios[numMed][1]=Double.parseDouble(jTextField5.getText().trim());

numMed++;

JOptionPane.showMessageDialog(null,"Se agregó con exito", null,

JOptionPane.INFORMATION_MESSAGE);

LimpiarCajas();

ActivarDesactivar2(false);

}

private void Aumentar() {

long newCod[]=new long[cod.length+5];

String newDat[][]=new String[cod.length+5][2];

int newUnid[]=new int[cod.length+5];

double newPrecios[][]=new double[cod.length+5][4];

for(int i=0;i<numMed;i++){

newCod[i]=cod[i];

newDat[i][0]=dat[i][0];

newDat[i][1]=dat[i][1];

newUnid[i]=unid[i];

newPrecios[i][0]=precios[i][0];

newPrecios[i][1]=precios[i][1];

}

cod=newCod;

dat=newDat;

unid=newUnid;

precios=newPrecios;

Page 29: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 29

}

/**

* Buscar el Producto y lo Muestra

*/

private void BuscarParaModificar() {

int resp=-1;

for(int i=0;i<numMed;i++){

if(Long.parseLong(jTextField6.getText().trim())==cod[i]){

jTextField7.setText(dat[i][0]);

jTextField20.setText(dat[i][1]);

jTextField8.setText(unid[i]+"");

jTextField9.setText(precios[i][0]+"");

jTextField10.setText(precios[i][1]+"");

jButton6.setEnabled(true);

resp=0;

}

}

if(resp!=0){

LimpiarCajas();

JOptionPane.showMessageDialog(null,"No se ha encontrado Producto \ncon ese Codigo. Verifique ...

!!","Error", JOptionPane.ERROR_MESSAGE);

}

}

/**

* Activa las Cajas si quieres Modificar

* @param siNo

*/

private void ActivarDesactivar3(boolean siNo) {

jTextField7.setEditable(siNo);

jTextField20.setEditable(siNo);

jTextField8.setEditable(siNo);

jTextField9.setEditable(siNo);

jTextField10.setEditable(siNo);

jButton7.setEnabled(siNo);

}

/**

* Modifica los Datos antes Ingresados

*/

private void Modificar() {

for(int i=0;i<numMed;i++){

if(cod[i]==Long.parseLong(jTextField6.getText().trim())){

dat[i][0]=jTextField7.getText();

dat[i][1]=jTextField20.getText();

unid[i]=Integer.parseInt(jTextField8.getText().trim());

precios[i][0]=Double.parseDouble(jTextField9.getText().trim());

precios[i][1]=Double.parseDouble(jTextField10.getText().trim());

JOptionPane.showMessageDialog(null,"Se Modificó con Exito","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

ActivarDesactivar3(false);

LimpiarCajas();

}

}

}

Page 30: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 30

/**

* Ordena los datos ingresados por Cod, Nom , Desc , Cant y Precios

*/

private void OrdenarCod() {

long temp1;

String temp2,temp3;

String datos[][]=new String[numMed][5];

int temp4;

double temp5;

for(int i=0;i<numMed-1;i++){

for(int j=i+1;j<numMed;j++){

if(cod[i]>=cod[j]){

temp1=cod[i];

cod[i]=cod[j];

cod[j]=temp1;

temp2=dat[i][0];

dat[i][0]=dat[j][0];

dat[j][0]=temp2;

temp3=dat[i][1];

dat[i][1]=dat[j][1];

dat[j][1]=temp3;

temp4=unid[i];

unid[i]=unid[j];

unid[j]=temp4;

temp5=precios[i][1];

precios[i][1]=precios[j][1];

precios[j][1]=temp5;

}

}

}

for(int i=0;i<numMed;i++){

datos[i][0]=cod[i]+"";

datos[i][1]=dat[i][0];

datos[i][2]=dat[i][1];

datos[i][3]=unid[i]+"";

datos[i][4]=precios[i][1]+"";

}

if(numMed!=0){

jTable1.setModel(new ModeloTabla(datos,numMed));

}else{

JOptionPane.showMessageDialog(null,"No hay Productos Que Mostrar","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

}

}

private void OrdenarNom() {

long temp1;

String temp2,temp3;

String datos[][]=new String[numMed][5];

int temp4;

double temp5;

for(int i=0;i<numMed-1;i++){

Page 31: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 31

for(int j=i+1;j<numMed;j++){

if(dat[i][0].compareToIgnoreCase(dat[j][0])>0){

temp1=cod[i];

cod[i]=cod[j];

cod[j]=temp1;

temp2=dat[i][0];

dat[i][0]=dat[j][0];

dat[j][0]=temp2;

temp3=dat[i][1];

dat[i][1]=dat[j][1];

dat[j][1]=temp3;

temp4=unid[i];

unid[i]=unid[j];

unid[j]=temp4;

temp5=precios[i][1];

precios[i][1]=precios[j][1];

precios[j][1]=temp5;

}

}

}

for(int i=0;i<numMed;i++){

datos[i][0]=cod[i]+"";

datos[i][1]=dat[i][0];

datos[i][2]=dat[i][1];

datos[i][3]=unid[i]+"";

datos[i][4]=precios[i][1]+"";

}

if(numMed!=0){

jTable1.setModel(new ModeloTabla(datos,numMed));

}else{

JOptionPane.showMessageDialog(null,"No hay Productos Que Mostrar","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

}

}

private void OrdenarDesc() {

long temp1;

String temp2,temp3;

String datos[][]=new String[numMed][5];

int temp4;

double temp5;

for(int i=0;i<numMed-1;i++){

for(int j=i+1;j<numMed;j++){

if(dat[i][1].compareToIgnoreCase(dat[j][1])>0){

temp1=cod[i];

cod[i]=cod[j];

cod[j]=temp1;

temp2=dat[i][0];

dat[i][0]=dat[j][0];

dat[j][0]=temp2;

temp3=dat[i][1];

Page 32: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 32

dat[i][1]=dat[j][1];

dat[j][1]=temp3;

temp4=unid[i];

unid[i]=unid[j];

unid[j]=temp4;

temp5=precios[i][1];

precios[i][1]=precios[j][1];

precios[j][1]=temp5;

}

}

}

for(int i=0;i<numMed;i++){

datos[i][0]=cod[i]+"";

datos[i][1]=dat[i][0];

datos[i][2]=dat[i][1];

datos[i][3]=unid[i]+"";

datos[i][4]=precios[i][1]+"";

}

if(numMed!=0){

jTable1.setModel(new ModeloTabla(datos,numMed));

}else{

JOptionPane.showMessageDialog(null,"No hay Productos Que Mostrar","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

}

}

private void OrdenarCant() {

long temp1;

String temp2,temp3;

String datos[][]=new String[numMed][5];

int temp4;

double temp5;

for(int i=0;i<numMed-1;i++){

for(int j=i+1;j<numMed;j++){

if(unid[i]>=unid[j]){

temp1=cod[i];

cod[i]=cod[j];

cod[j]=temp1;

temp2=dat[i][0];

dat[i][0]=dat[j][0];

dat[j][0]=temp2;

temp3=dat[i][1];

dat[i][1]=dat[j][1];

dat[j][1]=temp3;

temp4=unid[i];

unid[i]=unid[j];

unid[j]=temp4;

temp5=precios[i][1];

precios[i][1]=precios[j][1];

precios[j][1]=temp5;

}

}

Page 33: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 33

}

for(int i=0;i<numMed;i++){

datos[i][0]=cod[i]+"";

datos[i][1]=dat[i][0];

datos[i][2]=dat[i][1];

datos[i][3]=unid[i]+"";

datos[i][4]=precios[i][1]+"";

}

if(numMed!=0){

jTable1.setModel(new ModeloTabla(datos,numMed));

}else{

JOptionPane.showMessageDialog(null,"No hay Productos Que Mostrar","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

}

}

private void OrdenarPrec() {

long temp1;

String temp2,temp3;

String datos[][]=new String[numMed][5];

int temp4;

double temp5;

for(int i=0;i<numMed-1;i++){

for(int j=i+1;j<numMed;j++){

if(precios[i][1]>=precios[j][1]){

temp1=cod[i];

cod[i]=cod[j];

cod[j]=temp1;

temp2=dat[i][0];

dat[i][0]=dat[j][0];

dat[j][0]=temp2;

temp3=dat[i][1];

dat[i][1]=dat[j][1];

dat[j][1]=temp3;

temp4=unid[i];

unid[i]=unid[j];

unid[j]=temp4;

temp5=precios[i][1];

precios[i][1]=precios[j][1];

precios[j][1]=temp5;

}

}

}

for(int i=0;i<numMed;i++){

datos[i][0]=cod[i]+"";

datos[i][1]=dat[i][0];

datos[i][2]=dat[i][1];

datos[i][3]=unid[i]+"";

datos[i][4]=precios[i][1]+"";

}

if(numMed!=0){

jTable1.setModel(new ModeloTabla(datos,numMed));

}else{

JOptionPane.showMessageDialog(null,"No hay Productos Que Mostrar","Mensaje",

JOptionPane.INFORMATION_MESSAGE);

Page 34: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 34

}

}

/**

* Busca el Producto y lo muestra en la Ventana comprar

*/

private void BuscarMostrarDatos() {

int resp=-1;

for(int i=0;i<numMed;i++){

if(cod[i]==Long.parseLong(jTextField11.getText().trim())){

jTextField12.setText(dat[i][0]);

jTextField13.setText(cod[i]+"");

jTextField14.setText(unid[i]+"");

jTextField15.setText(precios[i][1]+"");

jButton9.setEnabled(true);

jButton8.setEnabled(false);

jButton11.setEnabled(true);

resp=0;

}

}

if(resp!=0){

JOptionPane.showMessageDialog(null,"No se ha encontrado Producto \ncon ese Codigo. Verifique ...

!!","Error", JOptionPane.ERROR_MESSAGE);

}

}

/**

* Calcula el pago ,solo del Producto que se ha buscado y que se a puesto la cantidad a comprar

*/

private void CalcularSubTotal() {

if(Integer.parseInt(jTextField16.getText().trim())>Integer.parseInt(jTextField14.getText().trim())){

JOptionPane.showMessageDialog(null,"No contamos con dicho \nnúmero de Productos ...","Error",

JOptionPane.ERROR_MESSAGE);

}else{

double

pago=Integer.parseInt(jTextField16.getText().trim())*Double.parseDouble(jTextField15.getText().trim());

pago=Math.floor(pago*100+0.5)/100;

jTextField17.setText(pago+"");

jButton10.setEnabled(true);

}

}

/**

* Agregar al Area de Texto lo que se quiere comprar

*/

private void AgregarListaProducto1() {

String mensaje="

"+jTextField16.getText()+"\t"+jTextField17.getText()+"\t"+jTextField12.getText()+"\n";

String temp1;

if(jTextArea3.getText().compareTo("")==0){

AgregarListaProducto2(mensaje);

}else{

temp1=jTextArea3.getText();

jTextArea3.setText(temp1+mensaje);

}

listaProd=GuardarParaRecibo();

Page 35: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 35

pagoTotal=pagoTotal+Double.parseDouble(jTextField17.getText().trim());

pagoTotal=Math.floor(pagoTotal*100+0.5)/100;

jTextField18.setText(pagoTotal+"");

jButton12.setEnabled(true);

jButton10.setEnabled(false);

GuardarActualizar();

}

private void AgregarListaProducto2(String mensaje){

String mensaje1=mensaje;

String titulo1="\n Cantidad\tPago \tProducto\n * * * * * \t* * * *\t* * * * * * \n\n";

jTextArea3.setText(titulo1+mensaje1);

}

private void GuardarActualizar() {

codProd[numProd]=Long.parseLong(jTextField13.getText().trim());

cantProd[numProd]=Integer.parseInt(jTextField16.getText());

numProd++;

}

/**

* Se limpian las Cajas para Otro Producto

*/

private void OtroProducto() {

jButton8.setEnabled(true);

jTextField11.setText("");

jTextField12.setText("");

jTextField13.setText("");

jTextField14.setText("");

jTextField15.setText("");

jTextField16.setText("");

jTextField17.setText("");

jButton9.setEnabled(false);

jButton10.setEnabled(false);

}

/**

* Se envia los datos para Mostrar en el Recibo

*/

private void DatosDelRecibo() {

String mensaje="\n Cantidad \tProducto\tCodigo \tDescripción\tPago" +

"\n * * * * * *\t* * * * *\t* * * * * * \t* * * * * * *\t* * * * \n\n";

jButton12.setEnabled(false);

new Recibo().Recibir(mensaje+listaProd+"\n\t\t\t Pago Total "+pagoTotal);

jButton8.setEnabled(false);

jButton9.setEnabled(false);

jButton11.setEnabled(false);

CalcularUtil();

ActualizarDatos();

numClientes++;

}

private void ActualizarDatos() {

Page 36: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 36

for(int i=0;i<numProd;i++){

for(int j=0;j<numMed;j++){

if(codProd[i]==cod[j]){

unid[j]= unid[j]-cantProd[i];

}

}

}

}

private void CalcularUtil() {

double util=0;

for(int i=0;i<numProd;i++){

for(int j=0;j<numMed;j++){

if(codProd[i]==cod[j]){

util= util+(cantProd[i]*(precios[j][1]-precios[j][0]));

util=Math.floor(util*100+0.5)/100;

}

}

}

utilCliente[numClientes]=util;

}

/**

* Se Borra los datos para realizar una Nueva Compra

*/

private void ReiniciarCompra() {

pagoTotal=0;

listaProd="";

numProd=0;

jTextArea3.setText("");

jTextField18.setText("");

OtroProducto();

jButton12.setEnabled(false);

jButton8.setEnabled(true);

jButton11.setEnabled(true);

}

private String GuardarParaRecibo() {

String mensaje="";

for(int i=0;i<numMed;i++){

if(Long.parseLong(jTextField11.getText().trim())==cod[i]){

mensaje="

"+jTextField16.getText()+"\t"+dat[i][0]+"\t"+cod[i]+"\t"+dat[i][1]+"\t"+jTextField17.getText()+"\n";

}

}

mensaje=listaProd+mensaje;

return mensaje;

}

private void LimpiarCajas() {

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

Page 37: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 37

jTextField7.setText("");

jTextField8.setText("");

jTextField9.setText("");

jTextField10.setText("");

jTextField19.setText("");

jTextField20.setText("");

}

/**

* Calcula la utilidad general que se ha generado

*/

private void CalcularUtilTotal() {

double utilTotal=0;

for(int i=0;i<numClientes;i++){

utilTotal=utilTotal+utilCliente[i];

}

JOptionPane.showConfirmDialog(null,"La Utilidad Total es :"+utilTotal, "Información",

JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE);

}

/**

* Muestra una lista de todas las ventas con la utilidad generada .

*/

private void Ventas() {

String mensaje="\n Nº de Cliente \tUtilidad Generada\n * * * * * * * * * * \t* * * * * * * * * * * *

\n\n";

for(int i=0;i<numClientes;i++){

mensaje=mensaje+" * Cliente ["+(i+1)+"] \t"+utilCliente[i]+"\n";

}

jTextArea1.setText(mensaje);

}

private void Mostrar() {

String mensaje="\nCodigo\tNombre\tDescripción\tCantidad\tEstado\n* * * * *\t* * * * *\t* * * * * * * *\t*

* * * * * *\t* * * * *\n\n";

for(int i=0;i<numMed;i++){

if(unid[i]<=5 && unid[i]!=0){

mensaje=mensaje+" "+cod[i]+"\t"+dat[i][0]+"\t"+dat[i][1]+"\t"+unid[i]+"\tSe esta Agotando\n";

}else{

if(unid[i]==0){

mensaje=mensaje+" "+cod[i]+"\t"+dat[i][0]+"\t"+dat[i][1]+"\t"+unid[i]+"\tSe Agoto\n";

}

}

}

jTextArea1.setText(mensaje);

}

/**

* Busca y muestra los datos del codido del Medicamento para despues eliminar.

*/

private void BuscarParaEliminar() {

int resp=-1;

String mensaje="";

for(int i=0;i<numMed;i++){

if(Integer.parseInt(jTextField21.getText())==cod[i]){

mensaje="\n * Nombre : "+dat[i][0]+"\n\n * Descripción : "+dat[i][1]+"\n\n * Cantidad :

"+unid[i]+"\n\n * Precio de Costo :"+precios[i][0]+"\n\n * Precios de Venta : "+precios[i][1];

Page 38: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 38

jButton23.setEnabled(true);

resp=0;

}

}

if(resp!=0){

JOptionPane.showMessageDialog(null,"No se ha encontrado Producto \ncon ese Codigo. Verifique ...

!!","Error", JOptionPane.ERROR_MESSAGE);

}

jTextArea2.setText(mensaje);

}

/**

* Elimina el producto que no se desea tener

*/

private void Eliminar() {

int pos=-1;

for(int i=0;i<numMed;i++){

if(Integer.parseInt(jTextField21.getText())==cod[i]){

pos=i;

}

}

if(pos>=0){

for(int i=pos;i<numMed;i++){

cod[i]=cod[i+1];

dat[i][0]=dat[i+1][0];

dat[i][1]=dat[i+1][1];

unid[i]=unid[i+1];

precios[i][0]=precios[i+1][0];

precios[i][1]=precios[i+1][1];

JOptionPane.showMessageDialog(null, "Se elimino con

Exito","Mensaje",JOptionPane.INFORMATION_MESSAGE);

}

numMed=numMed-1;

}

}

}

Código de la Clase FechaHora

package inkafarma;

import java.util.*;

public class FechaHora {

String zona[]=null;

SimpleTimeZone time;

Calendar calendar;

public FechaHora(){

zona = TimeZone.getAvailableIDs(-8*60*60*1000);

time=new SimpleTimeZone(-8*60*60*1000,zona[0]);

calendar=new GregorianCalendar(time);

}

Page 39: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 39

String CalcularFecha(){

String mensaje1=calendar.get(Calendar.DAY_OF_MONTH)+" / "+

(calendar.get(Calendar.MONTH)+1)+" / "+

calendar.get(Calendar.YEAR);

return mensaje1;

}

String CalcularHora(){

String mensaje2=(calendar.get(Calendar.HOUR_OF_DAY)+3)+" : "+

calendar.get(Calendar.MINUTE)+" : "+

calendar.get(Calendar.SECOND);

return mensaje2;

}

}

Código de la Clase ModeloTabla

package inkafarma;

import javax.swing.table.*;

/**

* El Modelo de la Tabla es el que controla todos los

* datos que se colocan en ella

*/

class ModeloTabla extends AbstractTableModel {

private String datos[][];

/**

* El constructor recibo un dato de tipo String y de tipo int ,

* al mismo tiempo imprime los datos en la tabla

*/

public ModeloTabla(String[][] dat,int numMed){

datos =new String[numMed][5];

for(int x=0;x<5;x++){

for( int i=0; i < datos.length; i++ ) {

for( int j=0; j < datos[i].length; j++ ){

datos[i][0]=dat[i][0];

datos[i][1]=dat[i][1];

datos[i][2]=dat[i][2];

datos[i][3]=dat[i][3];

datos[i][4]=dat[i][4];

}

}

}

}

/**

* Devuelve el número de columnas de la tabla

* @return

*/

public int getColumnCount() {

return( datos[0].length );

}

@Override

Page 40: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 40

/**

* Devuelve el nombre de las columnas de la tabla

*/

public String getColumnName(int columnIndex)

{

switch (columnIndex)

{

case 0: return "Codigo";

case 1: return "Nombre";

case 2: return "Decripción";

case 3: return "Cantidad";

case 4: return "Precio Venta";

default: return null;

}

}

/**

* Devuelve el número de filas de la tabla

* @return

*/

public int getRowCount() {

return( datos.length );

}

/**

* Devuelve el valor de una determinada casilla de la tabla

* identificada mediante fila y columna

*/

public String getValueAt( int fila,int col ) {

return( datos[fila][col] );

}

}

Código de la Clase Recibo

package inkafarma;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import org.jvnet.substance.SubstanceLookAndFeel;

import org.jvnet.substance.button.StandardButtonShaper;

public class Recibo extends JFrame{

private JLabel Label1,jLabel2,jLabel3,jLabel4,jLabel5,jLabel6,jLabel7,jLabel8,jLabel9;

private JLabel jLabel10,jLabel11,jLabel12,jLabel13;

private JPanel jPanel1;

private JLabel imageLabel1;

private JScrollPane jScrollPane1;

private JTextArea jTextArea1;

private JTextField jTextField1, jTextField2;

private ImageIcon icon1,icon2;

private JButton jButton1;

public Recibo(){

initComponents();

}

private void initComponents() {

jLabel1 = new JLabel();

Page 41: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 41

jLabel2 = new JLabel();

jLabel3 = new JLabel();

jLabel4 = new JLabel();

jLabel5 = new JLabel();

jLabel6 = new JLabel();

jLabel7 = new JLabel();

jLabel8 = new JLabel();

jLabel9 = new JLabel();

jLabel10 = new JLabel();

jLabel11 = new JLabel();

jLabel12 = new JLabel();

jLabel13 = new JLabel();

jPanel1 = new JPanel();

jTextField1 = new JTextField();

jTextField2 = new JTextField();

jScrollPane1 = new JScrollPane();

jTextArea1 = new JTextArea();

imageLabel1 =new JLabel();

jButton1 =new JButton();

icon1 = new ImageIcon(getClass().getResource("/Imagenes/icon1.png"));

icon2 = new ImageIcon(getClass().getResource("/Imagenes/icon4.png"));

setTitle("Recibo");

setSize(700, 485);

setLocationRelativeTo(null);

setDefaultCloseOperation(HIDE_ON_CLOSE);

setIconImage(icon1.getImage());

imageLabel1.setIcon(icon2);

imageLabel1.setBounds(30, 25, 280,90);

jLabel1.setText("Jr.La Merced 201-Huaura");

jLabel1.setBounds(350, 40, 150, 20);

jLabel2.setText("Telfs.:239-3547 Fax:239-6163");

jLabel2.setBounds(330, 60, 200, 20);

jLabel3.setText("HUACHO");

jLabel3.setBounds(380, 80, 150, 20);

jLabel4.setText("R.U.C Nº 547896215");

jLabel5.setText("BOLETA DE VENTA");

jLabel6.setText("Nº 2457896");

jPanel1.add(jLabel4);

jPanel1.add(jLabel5);

jPanel1.add(jLabel6);

jPanel1.setBorder(BorderFactory.createEtchedBorder());

jPanel1.setBounds(510, 35, 150,80);

jLabel7.setText("Fecha :");

jLabel7.setBounds(30, 140, 80, 20);

jTextField1.setEditable(false);

jTextField1.setBounds(100, 140, 100, 20);

jLabel8.setText("Hora :");

jLabel8.setBounds(220, 140, 80, 20);

jTextField2.setEditable(false);

jTextField2.setBounds(280,140, 100,20);

Page 42: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 42

jTextArea1.setEnabled(false);

jTextArea1.setFont(new Font("Arial Unicode MS", 1, 14));

jTextArea1.setWrapStyleWord(true);

jScrollPane1.setViewportView(jTextArea1);

jScrollPane1.setBounds(30, 180, 630, 200);

jLabel9.setText("Donde Cada Precio es un Remedio");

jLabel9.setBounds(40, 410, 200, 20);

jLabel10.setText("¡No se aceptan Devoluciones!");

jLabel10.setBounds(280, 390, 200, 20);

jLabel11.setText("Cambio de Mercaderia se hara dentro de las 48 horas");

jLabel11.setBounds(240, 410, 280, 20);

jLabel12.setText("previa presentación de su Comprobante");

jLabel12.setBounds(260, 430, 200, 20);

jLabel13.setText("www.inkafarma.com.pe");

jLabel13.setBounds(540, 410, 150, 20);

jButton1.setText("Conforme");

jButton1.setBounds(530,135, 100, 25);

jButton1.putClientProperty(SubstanceLookAndFeel.BUTTON_SHAPER_PROPERTY, new

StandardButtonShaper());

jButton1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {

dispose();

}

});

Container contenedor=this.getContentPane();

contenedor.setLayout(null);

contenedor.add(imageLabel1);

contenedor.add(jLabel1);

contenedor.add(jLabel2);

contenedor.add(jLabel3);

contenedor.add(jLabel7);

contenedor.add(jLabel8);

contenedor.add(jLabel9);

contenedor.add(jLabel10);

contenedor.add(jLabel11);

contenedor.add(jLabel12);

contenedor.add(jLabel13);

contenedor.add(jPanel1);

contenedor.add(jTextField1);

contenedor.add(jTextField2);

contenedor.add(jScrollPane1);

contenedor.add(jButton1);

}

public void Recibir(String mensaje){

jTextField1.setText(" "+new FechaHora().CalcularFecha());

jTextField2.setText(" "+new FechaHora().CalcularHora());

jTextArea1.setText(mensaje);

this.setVisible(true);

}

}

Page 43: GUI Interfaz Gráfica de Usuario

“Universidad Nacional José Faustino Sánchez Carrión”

pág. 43

Bibliografía

Método de las 6’D (Modelamiento – Algoritmo – Programación ):

Juan Jose Flores Cueto

Carmen Bertolotti Zuñiga