Documentos de Académico
Documentos de Profesional
Documentos de Cultura
CORRUPCIÓN
E IMPUNIDAD”
Estudiante:
Amalia Cevallos Correa
Ciclo: IV
Grupo: A
1. Diseña el siguiente menú utlizando el JMenuBar y JMenuItem.
Mantenimiento
Docente
Alumno
Apoderado
Semestre
Académico
Nivel de Estudios
Grado
Curso
Procesos
Matricula
Renovación de Matrícula
public MenuPrincipal() {
initComponents();
AWTUtilities.setWindowOpaque(this, false);
this.setLocationRelativeTo(this);
this.menu.setSelected(true); int
posicion = this.panelmenu.getX();
if(posicion >-1){
Animacion.Animacion.mover_izquierda(0, -188, 2, 2, panelmenu);
}else{
Animacion.Animacion.mover_derecha(-188, 0, 2, 2, panelmenu);
}
}
private void unoActionPerformed(java.awt.event.ActionEvent evt) {
new CambiaPanel (panelprincipal, new inicio());
if(this.uno.isSelected()){
this.uno.setColorNormal(new Color(38,86,186));
this.uno.setColorHover(new Color(38,86,186));
this.uno.setColorPressed(new Color(38,86,186));
this.dos.setColorNormal(new Color(0,0,0));
this.dos.setColorHover(new Color(38,86,186));
this.dos.setColorPressed(new Color(0,0,0));
this.tres.setColorNormal(new Color(0,0,0));
this.tres.setColorHover(new Color(38,86,186));
this.tres.setColorPressed(new Color(0,0,0));
}else{
this.uno.setColorNormal(new Color(0,0,0));
this.uno.setColorHover(new Color(38,86,186));
this.uno.setColorPressed(new Color(0,0,0));
}
}
private void dosActionPerformed(java.awt.event.ActionEvent evt) {
if(this.dos.isSelected()){ this.uno.setColorNormal(new
Color(0,0,0)); this.uno.setColorHover(new
Color(38,86,186)); this.uno.setColorPressed(new
Color(0,0,0));
this.dos.setColorNormal(new Color(38,86,186));
this.dos.setColorHover(new Color(38,86,186));
this.dos.setColorPressed(new Color(38,86,186));
this.tres.setColorNormal(new Color(0,0,0));
this.tres.setColorHover(new Color(38,86,186));
this.tres.setColorPressed(new Color(0,0,0));
}else{
this.dos.setColorNormal(new Color(0,0,0));
this.dos.setColorHover(new Color(38,86,186));
this.dos.setColorPressed(new Color(0,0,0));
}
new Menu1().setVisible(true);
dispose();
}
MENU
package Paneles; import
Actividad11.MenuPrincipal; import
java.awt.event.ActionEvent; import
java.awt.event.ActionListener; import
java.text.SimpleDateFormat; import
java.util.Calendar;
Calculo
package Paneles; import
javax.swing.JOptionPane; import
javax.swing.ImageIcon; public class Calculo
extends javax.swing.JFrame {
ImageIcon icosalir = new ImageIcon("src/imgenes/salir.png");
ImageIcon icolimpia = new ImageIcon("src/imgenes/limpia.png");
ImageIcon icoejecuta = new ImageIcon("src/imgenes/ejecutar.png");
public Calculo() { initComponents();
setLocationRelativeTo(null); btn3.setIcon(icosalir);
btn3.setIconTextGap(2);
btn3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn2.setIcon(icolimpia); btn2.setIconTextGap(2);
btn2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn1.setIcon(icoejecuta); btn1.setIconTextGap(2);
btn1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new
javax.swing.JPanel(); jLabel1 =
new javax.swing.JLabel(); jLabel2
= new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
btn1 = new javax.swing.JButton();
btn2 = new javax.swing.JButton();
btn3 = new javax.swing.JButton();
t1 = new javax.swing.JTextField();
t2 = new javax.swing.JTextField();
eti1 = new javax.swing.JLabel();
eti2 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
btn1.setText("CALCULAR"); btn1.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
jPanel1.add(btn1, new org.netbeans.lib.awtextra.AbsoluteConstraints(23, 104,
-1, -1));
btn2.setText("LIMPIAR"); btn2.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
jPanel1.add(btn2, new org.netbeans.lib.awtextra.AbsoluteConstraints(139,
104, -1, -1));
btn3.setText("REGRESAR"); btn3.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
jPanel1.add(btn3, new org.netbeans.lib.awtextra.AbsoluteConstraints(230,
104, -1, -1));
jPanel1.add(t1, new org.netbeans.lib.awtextra.AbsoluteConstraints(139, 23,
132, -1));
jPanel1.add(t2, new org.netbeans.lib.awtextra.AbsoluteConstraints(139, 66,
132, -1));
jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/imagenes/1.jpg"))); // NOI18N
jLabel5.setText("jLabel5");
jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,
360, 270));
pack();
}// </editor-fold>
CambiarFormulario(Clase)
package Paneles; import javax.swing.JFrame; public class
CambiaFormulario { private JFrame container; private
JFrame content; public CambiaFormulario(JFrame container,
JFrame content) {
this.container = container;
this.content = content;
this.container.removeAll();
this.container.revalidate();
this.container.repaint();
this.container.add(this.content);
this.container.revalidate(); this.container.repaint();
}
}
CambiarPanel(Clases)
package paneles;
/**
*
* @author RojeruSan
*/
import javax.swing.JPanel;
/**
* Constructor de clase
*/
public CambiaPanel(JPanel container, JPanel content)
{ this.container = container; this.content =
content; this.container.removeAll();
this.container.revalidate(); this.container.repaint();
this.container.add(this.content);
this.container.revalidate(); this.container.repaint();
}
}
camisas.java
package Paneles; import
javax.swing.JOptionPane;
import javax.swing.ImageIcon;
public class Camisas extends
javax.swing.JFrame {
btn2.setIcon(icolimpia); btn2.setIconTextGap(2);
btn2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn1.setIcon(icoejecuta); btn1.setIconTextGap(2);
btn1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new
javax.swing.JPanel(); jLabel1 =
new javax.swing.JLabel(); jLabel2
= new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
t1 = new javax.swing.JTextField();
t2 = new javax.swing.JTextField();
t3 = new javax.swing.JTextField();
eti1 = new javax.swing.JLabel();
eti2 = new javax.swing.JLabel();
eti3 = new javax.swing.JLabel();
btn1 = new javax.swing.JButton();
btn2 = new javax.swing.JButton();
btn3 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
eti1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti1, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 170,
81, 23));
eti2.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti2, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 200,
81, 23));
eti3.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti3, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 250,
81, 23));
btn1.setText("CALCULAR"); btn1.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
jPanel1.add(btn1, new org.netbeans.lib.awtextra.AbsoluteConstraints(380, 30,
-1, -1));
btn2.setText("LIMPIAR"); btn2.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
jPanel1.add(btn2, new org.netbeans.lib.awtextra.AbsoluteConstraints(390,
100, -1, -1));
btn3.setText("REGRESAR"); btn3.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
jPanel1.add(btn3, new org.netbeans.lib.awtextra.AbsoluteConstraints(380,
170, -1, -1));
jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/imagenes/jellyfish-
698521_1920.jpg"))); // NOI18N
jLabel7.setText("jLabel7");
jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,
550, 300));
);
pack();
}// </editor-fold>
double operacion1,operacion2,igv;
can = Double.parseDouble(t1.getText());
costo = Double.parseDouble(t2.getText());
des = Double.parseDouble(t3.getText());
operacion1=(can*costo);
operacion2=(operacion1*des)/100;
mostarcosto=operacion1-operacion2;
eti1.setText(""+mostarcosto);
igv=(mostarcosto*19); mostarigv=igv/100;
eti2.setText(""+mostarigv);
montoapagar=mostarcosto+mostarigv;
eti3.setText(""+montoapagar);
}
Comprapc.java
package Paneles; import javax.swing.JOptionPane;
import javax.swing.ImageIcon; import
javax.swing.table.DefaultTableModel; public class
Comprapc extends javax.swing.JFrame {
ImageIcon icosalir = new ImageIcon("src/imagenes/salir.png");
ImageIcon icolimpia = new ImageIcon("src/imagenes/limpia.png");
ImageIcon icoejecuta = new ImageIcon("src/imagenes/ejecutar.png");
public Comprapc() { initComponents(); btn3.setIcon(icosalir);
btn3.setIconTextGap(2);
btn3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn2.setIcon(icolimpia); btn2.setIconTextGap(2);
btn2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn1.setIcon(icoejecuta); btn1.setIconTextGap(2);
btn1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
this.setLocationRelativeTo(null);
this.tabladetalles.setModel(Prueba);
this.Prueba.addColumn("FECHA DE LA COMPRA");
this.Prueba.addColumn("MOMBRE DEL CLIENTE");
this.Prueba.addColumn("APELLIDO DEL CLIENTE");
this.Prueba.addColumn("METODO DE PAGO");
this.Prueba.addColumn("GENERO");
this.Prueba.addColumn("TIPO DE PRODUCTO");
this.Prueba.addColumn("PRODUCTO");
this.Prueba.addColumn("DESCIPCION DEL PRODUCTO");
this.Prueba.addColumn("CANTIDAD");
this.Prueba.addColumn("PRECIO UNITARIO");
this.Prueba.addColumn("TOTAL A PAGAR");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Cliente
:", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
jLabel2.setText("Nombres :");
jLabel3.setText("Apellidos:");
jLabel4.setText("Fecha de compra:");
ncliente.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
nclienteKeyTyped(evt);
}
});
apellido.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
apellidoKeyTyped(evt);
}
});
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(txtfechadecompra,
javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addGap(55, 55, 55)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(apellido)
.addComponent(ncliente))))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(jLabel2)
.addComponent(ncliente,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(jLabel3)
.addComponent(apellido,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel4)
.addComponent(txtfechadecompra,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(22, Short.MAX_VALUE))
);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Stock",
javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
jLabel5.setText("Audio = 100");
jLabel6.setText("Video=200");
jLabel7.setText("Linea Blanca = 100");
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel2Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGap(51, 51, 51)
.addComponent(jLabel6)
.addGap(28, 28, 28)
.addComponent(jLabel7))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"Realizar Compra", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
jLabel8.setText("Tipo de Pago");
cbonacionalidad.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Seleccionar", "Credito", "Contado" }));
cbonacionalidad.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbonacionalidadActionPerformed(evt);
}
});
jLabel10.setText("Producto");
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"Género", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
buttonGroup1.add(r2);
r2.setText("Mujer");
buttonGroup1.add(r1);
r1.setSelected(true); r1.setText("Hombre");
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(r1)
.addComponent(r2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
nproducto.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
nproductoKeyTyped(evt);
}
});
jLabel9.setText("Cantidad :");
jLabel12.setText("Precio :");
cantidad.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
cantidadKeyTyped(evt);
}
});
precio.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
precioKeyTyped(evt);
}
});
eti1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
btn1.setText("CALCULAR"); btn1.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
btn2.setText("LIMPIAR"); btn2.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
btn3.setText("REGRESAR"); btn3.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(cbonacionalidad,
javax.swing.GroupLayout.PREFERRED_SIZE, 108,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(73, 73, 73)
.addComponent(cbotallas,
javax.swing.GroupLayout.PREFERRED_SIZE, 104,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabel8)
.addGap(133, 133, 133)
.addComponent(jLabel10))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(btn1)
.addGap(26, 26, 26)
.addComponent(btn2)
.addGap(18, 18, 18)
.addComponent(btn3)))
.addGap(51, 51, 51)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel9)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(nproducto,
javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.TRAILING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel14)
.addGap(36, 36, 36)
.addComponent(eti1,
javax.swing.GroupLayout.PREFERRED_SIZE, 114,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.TRAILING, false)
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jLabel12)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(precio,
javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtdescripcion,
javax.swing.GroupLayout.PREFERRED_SIZE, 234,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cantidad,
javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(jPanel3Layout.createSequentialGroup()
.addComponent(jPanel4,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(208, 208, 208)
.addComponent(jLabel13)))
.addContainerGap(146, Short.MAX_VALUE))))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(jLabel8)
.addComponent(jLabel10)
.addComponent(jLabel11)
.addComponent(nproducto,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(7, 7, 7)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(cantidad,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(precio,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12))
.addGap(18, 18, 18)
.addComponent(jLabel13))
.addGroup(jPanel3Layout.createSequentialGroup()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(cbonacionalidad,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cbotallas,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(3, 3, 3)
.addComponent(jPanel4,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(txtdescripcion,
javax.swing.GroupLayout.PREFERRED_SIZE, 53,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btn1)
.addComponent(btn2)
.addComponent(btn3))
.addGap(18, 18, 18)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(eti1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jLabel14)
.addGap(0, 13, Short.MAX_VALUE)))
.addGap(26, 26, 26))
);
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"DATOS DE USUARIO", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE,
922, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(93, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 138,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
);
jButton1.setText("LIMPIAR TABLA");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("ELIMINAR COMPRA");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("TOTAL A PAGAR");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
txtnetopagar.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addComponent(jPanel2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel1,
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,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(60, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addComponent(jPanel5,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGap(106, 106, 106)
.addComponent(jButton1)
.addGap(44, 44, 44)
.addComponent(jButton2)
.addGap(337, 337, 337)
.addComponent(jButton3)
.addGap(45, 45, 45)
.addComponent(txtnetopagar,
javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(156, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(419, 419, 419)
.addComponent(jLabel1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jPanel2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel3,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jButton3))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(txtnetopagar,
javax.swing.GroupLayout.PREFERRED_SIZE, 53,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(126, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
DefaultTableModel Prueba = new DefaultTableModel();
private void cbonacionalidadActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
if (cbonacionalidad.getSelectedIndex() == 2) {
if (this.r1.isSelected()) { if (cbotallas.getSelectedIndex() == 1) {
cantidad_s = Double.parseDouble(this.cantidad.getText());
precio_s = Double.parseDouble(this.precio.getText()); total_s =
(precio_s * cantidad_s) + ((cantidad_s * precio_s) * desc_s);
this.eti1.setText(String.valueOf(total_s));
}
}
}
//Seleciona M if
(cbonacionalidad.getSelectedIndex() == 2) {
if (this.r1.isSelected()) { if
(cbotallas.getSelectedIndex() == 2) { cantidad_m =
Double.parseDouble(this.cantidad.getText()); precio_m =
Double.parseDouble(this.precio.getText());
total_m = (precio_m * cantidad_m) + ((cantidad_m * precio_m) *
desc_m);
this.eti1.setText(String.valueOf(total_m));
}
}
}
//Seleciona L if
(cbonacionalidad.getSelectedIndex() == 2) {
if (this.r1.isSelected()) { if (cbotallas.getSelectedIndex() ==
3) { cantidad_l = Double.parseDouble(this.cantidad.getText());
precio_l = Double.parseDouble(this.precio.getText()); total_l =
(precio_l * cantidad_l) + ((cantidad_l * precio_l) * desc_l);
this.eti1.setText(String.valueOf(total_l));
}
}
}
}
}
}
}
//Seleciona M if
(cbonacionalidad.getSelectedIndex() == 2) {
if (this.r2.isSelected()) { if
(cbotallas.getSelectedIndex() == 2) { cantidad_m =
Double.parseDouble(this.cantidad.getText()); precio_m =
Double.parseDouble(this.precio.getText());
total_m = (precio_m * cantidad_m) + ((cantidad_m * precio_m) *
desc_m);
this.eti1.setText(String.valueOf(total_m));
}
}
}
//Seleciona L if
(cbonacionalidad.getSelectedIndex() == 2) {
if (this.r2.isSelected()) { if (cbotallas.getSelectedIndex() ==
3) { cantidad_l = Double.parseDouble(this.cantidad.getText());
precio_l = Double.parseDouble(this.precio.getText()); total_l =
(precio_l * cantidad_l) + ((cantidad_l * precio_l) * desc_l);
this.eti1.setText(String.valueOf(total_l));
}
}
}
}
public void descuentos_mujeres_peruanas() {
double cantidad_s, precio_s, total_s, desc_s = 0.06;
double cantidad_m, precio_m, total_m, desc_m = 0.08;
double cantidad_l, precio_l, total_l, desc_l = 0.09;
//Seleciona S if
(cbonacionalidad.getSelectedIndex() == 1) {
if (this.r2.isSelected()) { if (cbotallas.getSelectedIndex() == 1) {
cantidad_s = Double.parseDouble(this.cantidad.getText());
precio_s = Double.parseDouble(this.precio.getText()); total_s =
(precio_s * cantidad_s) - ((cantidad_s * precio_s) * desc_s);
this.eti1.setText(String.valueOf(total_s));
}
}
}
//Seleciona M
if (cbonacionalidad.getSelectedIndex() == 1) {
if (this.r2.isSelected()) { if
(cbotallas.getSelectedIndex() == 2) { cantidad_m =
Double.parseDouble(this.cantidad.getText()); precio_m =
Double.parseDouble(this.precio.getText());
total_m = (precio_m * cantidad_m) - ((cantidad_m * precio_m) *
desc_m);
this.eti1.setText(String.valueOf(total_m));
}
}
}
// Seleciona L if
(cbonacionalidad.getSelectedIndex() == 1) {
if (this.r2.isSelected()) { if (cbotallas.getSelectedIndex() ==
3) { cantidad_l = Double.parseDouble(this.cantidad.getText());
precio_l = Double.parseDouble(this.precio.getText()); total_l =
(precio_l * cantidad_l) - ((cantidad_l * precio_l) * desc_l);
this.eti1.setText(String.valueOf(total_l));
}
}
}
}
}
}
}
}
private void btn1ActionPerformed(java.awt.event.ActionEvent evt) {
descuentos_hombres_peruanos();
descuentos_mujeres_peruanas();
descuentos_hombres_extrangeros();
descuentos_mujeres_extrangeras();
//Llave de Abren y cierran
if (r1.isSelected()) {
this.Prueba.addRow(new Object[]{this.txtfechadecompra.getDate(),
this.ncliente.getText(), this.apellido.getText(),
this.cbonacionalidad.getSelectedItem(), "Hombre",
this.cbotallas.getSelectedItem(), this.nproducto.getText(),
this.txtdescripcion.getText(), this.cantidad.getText(),
this.precio.getText(), this.eti1.getText()});
} else if (r2.isSelected()) {
this.Prueba.addRow(new Object[]{this.txtfechadecompra.getDate(),
this.ncliente.getText(), this.apellido.getText(),
this.cbonacionalidad.getSelectedItem(), "Mujer",
this.cbotallas.getSelectedItem(), this.nproducto.getText(),
this.txtdescripcion.getText(), this.cantidad.getText(),
this.precio.getText(), this.eti1.getText()});
}
}
private void btn2ActionPerformed(java.awt.event.ActionEvent evt) {
this.cbonacionalidad.setSelectedIndex(0);
if (r1.isSelected()) {
}
if (r2.isSelected()) {
}
this.cbotallas.setSelectedIndex(0);
this.nproducto.setText("");
this.cantidad.setText("");
this.precio.setText(""); this.eti1.setText("");
this.ncliente.setText("");
this.apellido.setText("");
this.txtfechadecompra.setDate(null);
this.txtdescripcion.setText("");
}
if (Character.isDigit(validar)) {
getToolkit().beep();
evt.consume();
if (Character.isDigit(validar)) {
getToolkit().beep();
evt.consume();
JOptionPane.showMessageDialog(null,
"ERROR... INGRESE SOLO LETRAS");
}
}
private void nproductoKeyTyped(java.awt.event.KeyEvent evt) {
char validar = evt.getKeyChar();
if (Character.isDigit(validar)) {
getToolkit().beep();
evt.consume();
if (Character.isLetter(validar)) {
getToolkit().beep();
evt.consume();
if (Character.isLetter(validar)) {
getToolkit().beep();
evt.consume();
JOptionPane.showMessageDialog(null, "ERROR... INGRESE SOLO
NUMEROS");
}
}
btn2.setIcon(icolimpia);
btn2.setIconTextGap(2);
btn2.setHorizontalAlignment(javax.swing.SwingCons
tants.CENTER);
btn2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn1.setIcon(icoejecuta); btn1.setIconTextGap(2);
btn1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
}
/**
* This method is called from within the constructor to initialize the form. *
WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel6.setText("jLabel6");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
btn1.setText("CALCULAR"); btn1.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
jPanel1.add(btn1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 49,
1, -1));
btn2.setText("LIMPIAR");
btn2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
jPanel1.add(btn2, new org.netbeans.lib.awtextra.AbsoluteConstraints(140, 50,
-1, -1));
btn3.setText("REGRESAR"); btn3.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
jPanel1.add(btn3, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 50,
-1, -1));
jLabel2.setText("Pies :");
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(22,
98, -1, -1));
jLabel3.setText("Yardas :");
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(22,
142, -1, -1));
jLabel4.setText("Centimetros :");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(22,
187, -1, -1));
jLabel5.setText("Metros :");
jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(22,
240, -1, -1));
jPanel1.add(n1, new org.netbeans.lib.awtextra.AbsoluteConstraints(158, 11,
128, -1));
eti1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti1, new org.netbeans.lib.awtextra.AbsoluteConstraints(127, 98,
122, 26));
eti2.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti2, new org.netbeans.lib.awtextra.AbsoluteConstraints(127, 142,
122, 26));
eti3.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti3, new org.netbeans.lib.awtextra.AbsoluteConstraints(127, 186,
122, 26));
eti4.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti4, new org.netbeans.lib.awtextra.AbsoluteConstraints(127, 230,
122, 26));
jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/imagenes/light-
1282314_1920.jpg"))); // NOI18N
jLabel7.setText("jLabel7");
jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10,
10, 1650, 1150));
pack();
}// </editor-fold>
eti2.setText("");
eti3.setText("");
eti4.setText("");
}
Ventadecomputadoras.java
package Paneles; import javax.swing.JOptionPane; import
javax.swing.ImageIcon; public class ventacomputadoras
extends javax.swing.JFrame {
ImageIcon icosalir = new ImageIcon("src/imagenes/salir.png");
ImageIcon icolimpia = new ImageIcon("src/imagenes/limpia.png");
ImageIcon icoejecuta = new ImageIcon("src/imagenes/ejecutar.png");
public ventacomputadoras() { initComponents();
setLocationRelativeTo(null); btn3.setIcon(icosalir);
btn3.setIconTextGap(2);
btn3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn2.setIcon(icolimpia); btn2.setIconTextGap(2);
btn2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
btn1.setIcon(icoejecuta); btn1.setIconTextGap(2);
btn1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
btn1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
btn1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
btn1.setText("CALCULAR"); btn1.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn1ActionPerformed(evt);
}
});
jPanel1.add(btn1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 70, -
1, -1));
btn2.setText("LIMPIAR"); btn2.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn2ActionPerformed(evt);
}
});
jPanel1.add(btn2, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 70,
-1, -1));
btn3.setText("REGRESAR"); btn3.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
btn3ActionPerformed(evt);
}
});
jPanel1.add(btn3, new org.netbeans.lib.awtextra.AbsoluteConstraints(260, 70,
-1, -1));
jLabel2.setText("Descuento :");
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(64,
111, -1, -1));
jLabel3.setText("Impuesto :");
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(64,
169, -1, -1));
eti1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti1, new org.netbeans.lib.awtextra.AbsoluteConstraints(158, 111,
97, 28));
eti2.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti2, new org.netbeans.lib.awtextra.AbsoluteConstraints(158, 155,
97, 28));
eti3.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel1.add(eti3, new org.netbeans.lib.awtextra.AbsoluteConstraints(158, 206,
97, 28));
jPanel1.add(n1, new org.netbeans.lib.awtextra.AbsoluteConstraints(172, 24,
112, -1));
jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/imagenes/japanese-cherry-trees-
324175_1920.jpg"))); // NOI18N
jLabel5.setText("jLabel5");
jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(-280,
-250, -1, -1));
pack();
}// </editor-fold>
Ventasdecarros.java
package Paneles;
import javax.swing.ImageIcon; import
javax.swing.JOptionPane;
jButton2.setIcon(icolimpia); jButton2.setIconTextGap(2);
jButton2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jButton2.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
jButton1.setIcon(icoejecuta);
jButton1.setIconTextGap(2);
jButton1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jButton1.setVerticalAlignment(javax.swing.SwingConstants.CENTER);
jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
jButton1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0))); jPanel1.setAlignmentX(50.0F);
jPanel1.setAlignmentY(50.0F);
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"Nùmero de Puertas", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
buttonGroup1.add(rd1);
rd1.setSelected(true); rd1.setText("Toyota");
buttonGroup1.add(rd2);
rd2.setText("Nissan");
buttonGroup1.add(rd3);
rd3.setText("Hyunday");
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(rd1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rd2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(rd3)
.addContainerGap(20, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(17, 17, 17)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(rd1)
.addComponent(rd2)
.addComponent(rd3))
.addContainerGap(17, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"Nùmero de Puertas", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
buttonGroup2.add(nrd3);
nrd3.setSelected(true);
nrd3.setText("3 Puertas");
buttonGroup2.add(nrd1);
nrd1.setText("4 Puertas");
buttonGroup2.add(nrd2);
nrd2.setText("5 Puertas");
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(nrd3)
.addGap(18, 18, 18)
.addComponent(nrd1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nrd2))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(17, 17, 17)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(nrd3)
.addComponent(nrd1)
.addComponent(nrd2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Forma de
Pago"));
buttonGroup3.add(contado);
contado.setSelected(true); contado.setText("Contado");
buttonGroup3.add(credito);
credito.setText("Credito");
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(contado)
.addGap(45, 45, 45)
.addComponent(credito)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53,
Short.MAX_VALUE)
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(ncuotas, javax.swing.GroupLayout.PREFERRED_SIZE,
142, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(contado)
.addComponent(credito)
.addComponent(jLabel2)
.addComponent(ncuotas,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(21, Short.MAX_VALUE))
);
jButton1.setText("CALCULAR");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("LIMPIAR");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("REGRESAR");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
"Resultado", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.DEFAULT_POSITION));
jLabel3.setText("DESCUENTO :");
jLabel6.setText("INCREMENTO :");
igv1.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jprecio.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
ldescuento.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
etiresultado.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jLabel11.setText("PRECIO :");
lincre.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(57, 57, 57)
.addComponent(jLabel5)
.addGap(27, 27, 27)
.addComponent(etiresultado,
javax.swing.GroupLayout.PREFERRED_SIZE, 184,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3))
.addGap(26, 26, 26)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING, false)
.addComponent(igv1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ldescuento,
javax.swing.GroupLayout.PREFERRED_SIZE, 117,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel6)
.addGap(18, 18, 18)
.addComponent(lincre,
javax.swing.GroupLayout.PREFERRED_SIZE, 106,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jLabel11)
.addGap(36, 36, 36)
.addComponent(jprecio,
javax.swing.GroupLayout.PREFERRED_SIZE, 106,
javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(0, 40, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel6Layout.createSequentialGroup()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel6)
.addComponent(ldescuento,
javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lincre, javax.swing.GroupLayout.PREFERRED_SIZE,
27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addComponent(jLabel4)
.addComponent(igv1, javax.swing.GroupLayout.PREFERRED_SIZE,
27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11)
.addComponent(jprecio,
javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.TRAILING)
.addComponent(etiresultado,
javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
txt1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txt1KeyTyped(evt);
}
});
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(83, 83, 83)
.addComponent(jButton1)
.addGap(55, 55, 55)
.addComponent(jButton2)
.addGap(76, 76, 76)
.addComponent(jButton3)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(77, 77, 77)
.addComponent(jLabel1)
.addGap(38, 38, 38)
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE,
163, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel4,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)
.addComponent(jPanel3,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(13, 13, 13)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(jLabel1)
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.LEADING, false)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton3))
.addGap(18, 18, 18)
.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>
to= ca*0.18;
if(nrd1.isSelected()){
rp=to*0.05; }if
(nrd2.isSelected()){
rp=to*0.08; }else
if(nrd3.isSelected()) {
rp=to;
}
if(contado.isSelected()){
descuento=rp-dee; igv = descuento *
0.18;
ldescuento.setText(String.valueOf(dee));
igv1.setText(String.valueOf(igv));
resultado=descuento; }else
if(credito.isSelected()){ if(ncu <= 24){
incremento=rp*0.05; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}if(ncu >24|| ncu >=42){
incremento=rp*0.07; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}else if(ncu > 42 ){
incremento=rp*0.09; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}
}
}
if(rd2.isSelected()) {
ni = ca*0.15;
if(nrd1.isSelected()){
rp=ni*0.05; }if
(nrd2.isSelected()){
rp=ni*0.08; }else
if(nrd3.isSelected()) {
rp=ni;
}
if(contado.isSelected()){
descuento=rp-dee; igv = descuento *
0.18;
ldescuento.setText(String.valueOf(dee));
igv1.setText(String.valueOf(igv));
resultado=descuento; }else
if(credito.isSelected()){ if(ncu <= 24){
incremento=rp*0.05; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}if(ncu >24|| ncu >=42){
incremento=rp*0.07; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}else if(ncu > 42 ){
incremento=rp*0.09;
igv = incremento * 0.18;
igv1.setText(String.valueOf(igv));
}
}
}
if(rd3.isSelected()){
hy=ca*0.12;
if(nrd1.isSelected()){
rp=hy*0.05; }if
(nrd2.isSelected()){
rp=hy*0.08; }else
if(nrd3.isSelected()) {
rp=hy;
}
if(contado.isSelected()){
descuento=rp-dee; igv = descuento *
0.18;
ldescuento.setText(String.valueOf(dee));
igv1.setText(String.valueOf(igv));
resultado=descuento; }else
if(credito.isSelected()){ if(ncu <= 24){
incremento=rp*0.05; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}if(ncu >24|| ncu >=42){
incremento=rp*0.07; igv =
incremento * 0.18;
igv1.setText(String.valueOf(igv));
}else if(ncu > 42 ){
incremento=rp*0.09;
igv = incremento * 0.18;
igv1.setText(String.valueOf(igv));
}
}
}
resultado=incremento;
etiresultado.setText(String.valueOf(resultado));
lincre.setText(""+incremento); jprecio.setText(""+ca);
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
txt1.setText(""); ncuotas.setText(""); ldescuento.setText("");
igv1.setText(""); lincre.setText(""); jprecio.setText("");
etiresultado.setText("");
}
} else {
}
}