Tarea33 PDF

Descargar como pdf o txt
Descargar como pdf o txt
Está en la página 1de 27

“AÑO DE LA LUCHA CONTRA LA CORRUPCIÓN E

IMPUNIDAD”

INTEGRANTES:

Johana Elizabeth Vidal Garcia


DOCENTE:
ING. Roberto Jose Velasquez Herrera

CURSO:
Programación Visual ll

Actividad:
Caso Problema de Unidad 01
CASO PROBLEMA:
Una tienda comercial desea registrar los distintos artefactos eléctricos indicando el nombre del
artefacto, la categoría del artefacto (audio, video o línea blanca), el stock, el precio y el modelo
del artefacto. También se desea registrar las ventas de artefactos indicando la fecha de venta y
el nombre del cliente que compró el artefacto. El cliente puede adquirir cualquier artefacto al
contado o al crédito. Si es al contado se aplica un descuento del 6% si es audio, 8% si es video y
9% si es línea blanca. Si la adquisición es al crédito se aplica un incremento del 10% si es audio,
12% si es video y 15% si es línea blanca. Después de presentarles el caso problema cada
estudiante deberá rea realizar lo siguiente:

• Crea las clases necesarias para ser luego ser usados en la programación visual.

• Diseña los formularios del caso de estudio aplicando los objetos de control básicos y los
objetos aprendidos en la I unidad de aprendizaje del curso. Debes considerar el manejo de los
distintos formas de crear formularios (JFrame, InternalFrame, JDialog,etc.)

• Aplica arreglos en el manejo de los datos de varios artefactos.

Clases
Caso Problema l
package casoproblemai;

import controlador.CtrlPrincipal;

import modelo.Artefacto;

import vista.Form_Principal;

public class CasoProblemaI {

public static void main(String[] args) {

Form_Principal miPrincipal = new Form_Principal();

Artefacto miArtefacto = new Artefacto();

CtrlPrincipal ctrlPrincipal = new CtrlPrincipal(miPrincipal, miArtefacto);

ctrlPrincipal.iniciar();

ControlPrincipal
package controlador;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.Date;

import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

import modelo.Artefacto;

import modelo.PersonalizarTabla;

import vista.Form_Principal;

/**

* @author decodem

*/

public class CtrlPrincipal implements ActionListener {

private Form_Principal miPrincipal;

private Artefacto miArtefacto;

private ArrayList<Artefacto> listaArtefactos = new ArrayList<Artefacto>();

DefaultTableModel modeloTablaArtefactos = new DefaultTableModel();

public CtrlPrincipal(Form_Principal miPrincipal, Artefacto miArtefacto) {

this.miPrincipal = miPrincipal;

this.miArtefacto = miArtefacto;
}

public void iniciar() {

/*Propiedades del JFrame*/

this.miPrincipal.setTitle("CASO PROBLEMA IU");

this.miPrincipal.setResizable(false);

this.miPrincipal.setLocationRelativeTo(null);

this.miPrincipal.setVisible(true);

/*Ponemos a escuchar los eventos de los componenetes*/

this.miPrincipal.botonRegistrar.addActionListener(this);

this.miPrincipal.botonCerrar.addActionListener(this);

this.miPrincipal.botonVenta.addActionListener(this);

this.miPrincipal.opcionSeleccionarArtefacto.addActionListener(this);

/*Set titulos a tabla*/

String titulos[] = {"Codigo", "Nombre", "Categoria", "Stock", "Precio"};

PersonalizarTabla.titulosTabla(titulos, modeloTablaArtefactos,
miPrincipal.tablaListaArtefactos);

cargarFecha();

@Override

public void actionPerformed(ActionEvent e) {

String comando = e.getActionCommand();

if (comando.equals("Registrar")) {
if (camposCompletos()) {

JOptionPane.showMessageDialog(null, "Complete todos los campos :-( ");

} else {

setDatosArtefacto();

resetCampos();

JOptionPane.showMessageDialog(null, "Se registro correctamente :-) ");

/*Cargar datos a tabla*/

PersonalizarTabla.cargarDatosTabla(miPrincipal.tablaListaArtefactos,
modeloTablaArtefactos, listaArtefactos);

} else if (comando.equals("Seleccionar a Comprar")) {

System.out.println("-------------------------");

} else if (comando.equals("Registrar Venta")) {

int fila = this.miPrincipal.tablaListaArtefactos.getSelectedRow();

if (fila <= -1) {

JOptionPane.showMessageDialog(null, " Debe seleccionar un item para realizar la


venta ");

} else {

/*---------------------------------------------------------*/

String cliente = this.miPrincipal.cajaCliente.getText();

String fecha = this.miPrincipal.cajaFecha.getText();

/*---------------------------------------------------------*/
int codigoArtefacto = Integer.parseInt((String)
this.miPrincipal.tablaListaArtefactos.getValueAt(fila, 0));

String nombreArtefacto = this.miPrincipal.tablaListaArtefactos.getValueAt(fila,


1).toString();

String categoriaArtefacto = this.miPrincipal.tablaListaArtefactos.getValueAt(fila,


2).toString();

int stockArtefacto = Integer.parseInt((String)


this.miPrincipal.tablaListaArtefactos.getValueAt(fila, 3));

double precioArtefacto = Double.parseDouble((String)


this.miPrincipal.tablaListaArtefactos.getValueAt(fila, 4));

/*Hacer verificaciones :-) */

int cantidadLlevar = Integer.parseInt(JOptionPane.showInputDialog(" Cantidad de


artefactos a llevar"));

if (cantidadLlevar > stockArtefacto) {

JOptionPane.showMessageDialog(null, "No hay suficiente stock :-(");

} else {

double totalPagar = 0.0;

double descuento = 0.0;

double incremento = 0.0;

if (this.miPrincipal.radioContado.isSelected()) {

if (categoriaArtefacto.equals("Audio")) {

descuento = precioArtefacto * 0.06;

} else if (categoriaArtefacto.equals("Video")) {

descuento = precioArtefacto * 0.08;

} else if (categoriaArtefacto.equals("Linea Blanca")) {

descuento = precioArtefacto * 0.09;

} else {

descuento = 0.0;

totalPagar = (precioArtefacto * cantidadLlevar) - descuento;


} else if (this.miPrincipal.radioCredito.isSelected()) {

if (categoriaArtefacto.equals("Audio")) {

incremento = precioArtefacto * 0.10;

} else if (categoriaArtefacto.equals("Video")) {

incremento = precioArtefacto * 0.12;

} else if (categoriaArtefacto.equals("Linea Blanca")) {

incremento = precioArtefacto * 0.15;

} else {

incremento = 0.0;

totalPagar = (precioArtefacto * cantidadLlevar) + incremento;

String resultado = "";

resultado += " ----- Venta realizada exitosamente -----\n";

resultado += "[+] Cliente : " + cliente;

resultado += "\n[+] Fecha : " + fecha;

resultado += "\n-------------------------------------";

resultado += "\nProductos comprado : \n";

resultado += "\n----------------------------------------------------------------";

resultado += "\n Codigo \tNombre \t Cantidad\t Precio U";

resultado += "\n> " + codigoArtefacto + " \t" + nombreArtefacto + " \t" +


cantidadLlevar + " \t" + precioArtefacto;

resultado += "\n----------------------------------------------------------------";

resultado += "\nTotal a pagar : " + totalPagar;

resultado += "\n ---------- Gracias por su compra ----------";

this.miPrincipal.areaResulatdos.setText(resultado);
descontarStockArtefacto(codigoArtefacto, cantidadLlevar, stockArtefacto);

} else if (comando.equals("Cerrar")) {

for (Artefacto miItemArtefacto : listaArtefactos) {

System.out.println("" + miItemArtefacto.getNombre());

private boolean camposCompletos() {

boolean verifica = this.miPrincipal.cajaNombre.getText().isEmpty()

|| this.miPrincipal.cajaModelo.getText().isEmpty()

|| this.miPrincipal.cajaPrecio.getText().isEmpty();

return verifica;

public void setDatosArtefacto() {

/*Obtener los datos del artefacto*/

int codigo = listaArtefactos.size() + 1;

String nombre = this.miPrincipal.cajaNombre.getText();

String categoria = this.miPrincipal.comboCategoria.getSelectedItem().toString();


String getStock = this.miPrincipal.spinnerStock.getValue().toString();

int stock = Integer.parseInt(getStock);

double precio = Double.parseDouble(this.miPrincipal.cajaPrecio.getText());

String modelo = this.miPrincipal.cajaModelo.getText();

/*Lllenamos nuestro ArrayList*/

listaArtefactos.add(new Artefacto(codigo, nombre, categoria, stock, precio, modelo));

private void resetCampos() {

this.miPrincipal.cajaNombre.setText("");

this.miPrincipal.comboCategoria.setSelectedIndex(0);

this.miPrincipal.spinnerStock.setValue(1);

this.miPrincipal.cajaPrecio.setText("");

this.miPrincipal.cajaModelo.setText("");

private void cargarFecha() {

Date date = new Date();

SimpleDateFormat formato = new SimpleDateFormat("dd-MM-yyyy");

String fecha = formato.format(date);

this.miPrincipal.cajaFecha.setText(fecha);

Artefacto

package modelo;
/**

* @author decodem

*/

public class Artefacto {

private int codigo = 0;

private String nombre = "";

private String categoria = "";

private int stock = 0;

private double precio = 0.0;

private String modelo = "";

public Artefacto() {

public Artefacto(int codigo, String nombre, String categoria, int stock, double precio, String
modelo) {

this.codigo = codigo;

this.nombre = nombre;

this.categoria = categoria;

this.stock = stock -1 ;

this.precio = precio;

this.modelo = modelo;

public int getCodigo() {

return codigo;
}

public void setCodigo(int codigo) {

this.codigo = codigo;

public String getNombre() {

return nombre;

public void setNombre(String nombre) {

this.nombre = nombre;

public String getCategoria() {

return categoria;

public void setCategoria(String categoria) {

this.categoria = categoria;

public int getStock() {

return stock;

public void setStock(int stock) {

this.stock = stock;

public double getPrecio() {


return precio;

public void setPrecio(double precio) {

this.precio = precio;

public String getModelo() {

return modelo;

public void setModelo(String modelo) {

this.modelo = modelo;

Framework Principal
Casol

import javax.swing.JOptionPane;

/**

* @author Decodem

*/

public class Form_Principal extends javax.swing.JFrame {

public Form_Principal() {

initComponents();

}
@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

buttonGroup1 = new javax.swing.ButtonGroup();

popupMenuOpcion = new javax.swing.JPopupMenu();

opcionSeleccionarArtefacto = new javax.swing.JMenuItem();

botonCerrar = new javax.swing.JButton();

botonRegistrar = new javax.swing.JButton();

cajaModelo = new javax.swing.JTextField();

jLabel9 = new javax.swing.JLabel();

cajaPrecio = new javax.swing.JTextField();

jLabel10 = new javax.swing.JLabel();

spinnerStock = new javax.swing.JSpinner();

jLabel11 = new javax.swing.JLabel();

comboCategoria = new javax.swing.JComboBox();

jLabel12 = new javax.swing.JLabel();

cajaNombre = new javax.swing.JTextField();

jLabel13 = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jSeparator1 = new javax.swing.JSeparator();

jLabel8 = new javax.swing.JLabel();

cajaFecha = new javax.swing.JTextField();

jLabel7 = new javax.swing.JLabel();

cajaCliente = new javax.swing.JTextField();

jPanel3 = new javax.swing.JPanel();

jScrollPane1 = new javax.swing.JScrollPane();

tablaListaArtefactos = new javax.swing.JTable();

botonVenta = new javax.swing.JButton();

jPanel5 = new javax.swing.JPanel();


jScrollPane2 = new javax.swing.JScrollPane();

areaResulatdos = new javax.swing.JTextArea();

jLabel2 = new javax.swing.JLabel();

radioContado = new javax.swing.JRadioButton();

radioCredito = new javax.swing.JRadioButton();

jLabel3 = new javax.swing.JLabel();

opcionSeleccionarArtefacto.setText("Seleccionar a Comprar");

opcionSeleccionarArtefacto.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

opcionSeleccionarArtefactoActionPerformed(evt);

});

popupMenuOpcion.add(opcionSeleccionarArtefacto);

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

botonCerrar.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

botonCerrar.setText("Cerrar");

botonCerrar.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

botonCerrarActionPerformed(evt);

});

botonRegistrar.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

botonRegistrar.setText("Registrar");

botonRegistrar.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

botonRegistrarActionPerformed(evt);

}
});

cajaModelo.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel9.setText("Modelo :");

cajaPrecio.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel10.setText("Precio :");

spinnerStock.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel11.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel11.setText("Stock :");

comboCategoria.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

comboCategoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] {


"Audio", "Video", "Linea Blanca" }));

jLabel12.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel12.setText("Categoria :");

cajaNombre.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel13.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel13.setText("Nombre : ");

jLabel1.setBackground(new java.awt.Color(153, 255, 255));

jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N


jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel1.setText("REGISTRO DE ARTEFACTO");

jSeparator1.setForeground(new java.awt.Color(0, 0, 204));

jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);

jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel8.setText("Cliente :");

cajaFecha.setEditable(false);

cajaFecha.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel7.setText("Fecha :");

cajaCliente.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Listado de Artefactos"));

tablaListaArtefactos.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

tablaListaArtefactos.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

},

new String [] {

));

tablaListaArtefactos.setComponentPopupMenu(popupMenuOpcion);

jScrollPane1.setViewportView(tablaListaArtefactos);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);

jPanel3.setLayout(jPanel3Layout);

jPanel3Layout.setHorizontalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel3Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 417,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

jPanel3Layout.setVerticalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel3Layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 107,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(32, 32, 32))

);

botonVenta.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

botonVenta.setText("Registrar Venta");

jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Resultados"));

areaResulatdos.setEditable(false);

areaResulatdos.setColumns(20);

areaResulatdos.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

areaResulatdos.setLineWrap(true);

areaResulatdos.setRows(5);

jScrollPane2.setViewportView(areaResulatdos);
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);

jPanel5.setLayout(jPanel5Layout);

jPanel5Layout.setHorizontalGroup(

jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel5Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane2)

.addContainerGap())

);

jPanel5Layout.setVerticalGroup(

jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel5Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 80,


Short.MAX_VALUE)

.addContainerGap())

);

jLabel2.setBackground(new java.awt.Color(0, 255, 204));

jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel2.setText("REALIZAR VENTA DE ARTEFACTO");

buttonGroup1.add(radioContado);

radioContado.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

radioContado.setSelected(true);

radioContado.setText("Contado");

buttonGroup1.add(radioCredito);

radioCredito.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

radioCredito.setText("Credito");
jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N

jLabel3.setText("Forma de pago :");

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)

.addGroup(layout.createSequentialGroup()

.addGap(32, 32, 32)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel13)

.addGap(18, 18, 18)

.addComponent(cajaNombre, javax.swing.GroupLayout.PREFERRED_SIZE,
119, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel12)

.addComponent(jLabel11)

.addComponent(jLabel10)

.addComponent(jLabel9))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(comboCategoria, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(spinnerStock)

.addComponent(cajaPrecio)

.addComponent(cajaModelo, javax.swing.GroupLayout.PREFERRED_SIZE,
122, javax.swing.GroupLayout.PREFERRED_SIZE)))))

.addGroup(layout.createSequentialGroup()

.addComponent(botonRegistrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(botonCerrar, javax.swing.GroupLayout.PREFERRED_SIZE, 120,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(18, 18, 18)

.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 11,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel3)

.addGap(15, 15, 15)

.addComponent(radioContado)

.addGap(18, 18, 18)

.addComponent(radioCredito)

.addGap(97, 97, 97))

.addGroup(layout.createSequentialGroup()

.addGap(33, 33, 33)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel7)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(cajaFecha, javax.swing.GroupLayout.PREFERRED_SIZE, 101,


javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel8)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(cajaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 117,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(16, 16, 16))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(botonVenta, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addContainerGap())))))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(16, 16, 16)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1)

.addGap(55, 55, 55)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel13)

.addComponent(cajaNombre,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel12)

.addComponent(comboCategoria,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jLabel11)

.addGap(6, 6, 6))

.addComponent(spinnerStock,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(34, 34, 34))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(cajaPrecio, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel10)))

.addGap(10, 10, 10)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel9)

.addComponent(cajaModelo, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(botonCerrar, javax.swing.GroupLayout.PREFERRED_SIZE,
47, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(botonRegistrar,
javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel2)

.addGap(28, 28, 28)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel7)

.addComponent(cajaFecha, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel8)

.addComponent(cajaCliente, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 143,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(radioCredito)

.addComponent(radioContado)

.addComponent(jLabel3))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(botonVenta)

.addGap(12, 12, 12)

.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addContainerGap()

.addComponent(jSeparator1)))

.addContainerGap())

);

pack();

}// </editor-fold>

private void botonCerrarActionPerformed(java.awt.event.ActionEvent evt) {

JOptionPane.showConfirmDialog(null, "Realmente desea salir de Sistema", "Confirmar salida",


JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);

System.exit(0);

private void botonRegistrarActionPerformed(java.awt.event.ActionEvent evt) {

private void opcionSeleccionarArtefactoActionPerformed(java.awt.event.ActionEvent evt) {

public static void main(String args[]) {

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Metal".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Form_Principal.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Form_Principal.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Form_Principal.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Form_Principal.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Form_Principal().setVisible(true);

});

// Variables declaration - do not modify

public static javax.swing.JTextArea areaResulatdos;

public static javax.swing.JButton botonCerrar;

public static javax.swing.JButton botonRegistrar;

public static javax.swing.JButton botonVenta;

private javax.swing.ButtonGroup buttonGroup1;


public static javax.swing.JTextField cajaCliente;

public static javax.swing.JTextField cajaFecha;

public static javax.swing.JTextField cajaModelo;

public static javax.swing.JTextField cajaNombre;

public static javax.swing.JTextField cajaPrecio;

public static javax.swing.JComboBox comboCategoria;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel12;

private javax.swing.JLabel jLabel13;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JPanel jPanel3;

private javax.swing.JPanel jPanel5;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JSeparator jSeparator1;

public static javax.swing.JMenuItem opcionSeleccionarArtefacto;

public static javax.swing.JPopupMenu popupMenuOpcion;

public static javax.swing.JRadioButton radioContado;

public static javax.swing.JRadioButton radioCredito;

public static javax.swing.JSpinner spinnerStock;

public static javax.swing.JTable tablaListaArtefactos;

// End of variables declaration

También podría gustarte