Vous êtes sur la page 1sur 30

FACULTAD DE: INGENIERA

ESCUELA PROFESIONAL DE: INGENIERA DE SISTEMAS

CENTRO ULADECH: SEDE HUARAZ

CURSO: PROGRAMACIN VISUAL I

CICLO: III

DOCENTE TUTOR: ING. MENDOZA CORPUZ CARLOS

AUTOR: CORAL QUIONES Rheynech Michael

HUARAZ 2015
1.- Usando el siguiente diseo de ventana construye una aplicacin que permita realizar la
matrculas de los cursos de un alumno, teniendo en cuenta lo siguiente:

package Matricula;

import com.sun.glass.events.KeyEvent;

import java.math.BigDecimal; import

java.math.RoundingMode; import

javax.swing.DefaultListModel; import

javax.swing.JOptionPane;

public class MatriculaCurso extends javax.swing.JFrame {

private DefaultListModel modelo1 = new DefaultListModel();

private DefaultListModel modelo2 = new DefaultListModel();

private DefaultListModel modelo3 = new DefaultListModel();

private DefaultListModel modelo4 = new DefaultListModel();

int indice = 0;
char teclado;

String costo, curso;

int cuenta, i, total = 0;

public MatriculaCurso()

{ initComponents();
setSize(580, 600);

setLocatonRelativeTo(null);
setTitle("MATRICULA DE CURSOS");

lstcursos.setModel(modelo1);

lstcostos.setModel(modelo2);

lstcursel.setModel(modelo3);

lstcos.setModel(modelo4);

DesHabilitarCampos();
}
public void DesHabilitarCampos() {

btnagregar.setEnabled(false);

btneliminar.setEnabled(false);

btncalcular.setEnabled(false);

btnlimpiar.setEnabled(false);

rbcon.setEnabled(false);

rbcre.setEnabled(false);

txtncoutoas.setEnabled(false);
}

public void LlenarCursos() {

modelo1.addElement("Responsabilidad Social VI");

modelo1.addElement("Ingenieria de Software II");

modelo1.addElement("Sistemas Oprerativos");

modelo1.addElement("Tecnologia Web");

modelo1.addElement("Investigacion de Operaciones");

modelo1.addElement("Fundamentos de Redes");

modelo1.addElement("Costos y Presupuestos");

modelo1.addElement("Administracion de Operaciones");

modelo1.addElement("Sistemas de Informacion");

modelo1.addElement("Microcontroladores");

public void Limpiar() {

buttonGroup1.clearSelection();

txtalu.setText("");

txtncoutoas.setText("");

modelo1.clear();

modelo2.clear();

modelo3.clear();
modelo4.clear();

txtdes.setText("");

txtincre.setText("");

txtmonto.setText("");

txttotal.setText("");

txtpagocouta.setText("");

lstcos.setSelectedIndex(5);

lstcostos.setSelectedIndex(5);

lstcursel.setSelectedIndex(5);

lstcursos.setSelectedIndex(5);

DesHabilitarCampos();

txtalu.requestFocus();

public void LlenarCosto() {

modelo2.addElement("2");

modelo2.addElement("4");

modelo2.addElement("3");

modelo2.addElement("4");

modelo2.addElement("3");

modelo2.addElement("3");

modelo2.addElement("2");

modelo2.addElement("2");

modelo2.addElement("4");

modelo2.addElement("3");
}

/**

* This method is called from within the constructor to initalize 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() {

buttonGroup1 = new javax.swing.ButtonGroup();

jLabel1 = new javax.swing.JLabel();

txtalu = new javax.swing.JTextField();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();


jScrollPane1 = new javax.swing.JScrollPane();

lstcursos = new javax.swing.JList();

jScrollPane2 = new javax.swing.JScrollPane();

lstcursel = new javax.swing.JList();

jScrollPane3 = new javax.swing.JScrollPane();

lstcostos = new javax.swing.JList();

jScrollPane4 = new javax.swing.JScrollPane();

lstcos = new javax.swing.JList();

btnagregar = new javax.swing.JButton();

btneliminar = new javax.swing.JButton();

jPanel1 = new javax.swing.JPanel();

rbcon = new javax.swing.JRadioButton();

rbcre = new javax.swing.JRadioButton();

jLabel8 = new javax.swing.JLabel();

txtncoutoas = new javax.swing.JTextField();

jLabel4 = new javax.swing.JLabel();


txttotal = new javax.swing.JTextField();

btncalcular = new javax.swing.JButton();

btnlimpiar = new javax.swing.JButton();

btncerrar = new javax.swing.JButton();

jLabel5 = new javax.swing.JLabel();


txtdes = new javax.swing.JTextField();

jLabel6 = new javax.swing.JLabel();

txtincre = new javax.swing.JTextField();

jLabel7 = new javax.swing.JLabel();

txtmonto = new javax.swing.JTextField();

jLabel9 = new javax.swing.JLabel();


txtpagocouta = new javax.swing.JTextField();

jLabel10 = new javax.swing.JLabel();

jLabel11 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setText("Alumno:");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130,


30, -1, -1));

txtalu.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorde
r.LOWERED));

txtalu.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyPressed(java.awt.event.KeyEvent evt) {

txtaluKeyPressed(evt);

public void keyTyped(java.awt.event.KeyEvent evt) {

txtaluKeyTyped(evt);

});

getContentPane().add(txtalu, new org.netbeans.lib.awtextra.AbsoluteConstraints(180, 30,


240, 20));

jLabel2.setText("Oferta de Cursos:");
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 70,
-1, -1));

jLabel3.setText("Cursos Seleccionados:");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(320,


70, -1, -1));

lstcursos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcursosValueChanged(evt);

});

jScrollPane1.setViewportView(lstcursos);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 190, 230));

lstcursel.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcurselValueChanged(evt);

});

jScrollPane2.setViewportView(lstcursel);

getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 90, 180, 220));

lstcostos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcostosValueChanged(evt);

});

jScrollPane3.setViewportView(lstcostos);
getContentPane().add(jScrollPane3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(200, 90, 40, 230));

lstcos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcosValueChanged(evt);

});

jScrollPane4.setViewportView(lstcos);

getContentPane().add(jScrollPane4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 90, 40, 220));

btnagregar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

btnagregar.setText(">>");

btnagregar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelB
order.RAISED));

btnagregar.addActonListener(new java.awt.event.ActonListener() {

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

btnagregarActionPerformed(evt);

});

getContentPane().add(btnagregar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(250, 160, 60, 30));

btneliminar.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

btneliminar.setText("<<");

btneliminar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.Bevel
Border.RAISED));

btneliminar.addActionListener(new java.awt.event.ActonListener() {

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


btneliminarActonPerformed(evt);

});

getContentPane().add(btneliminar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(250, 220, 60, 30));

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Forma de Pago"));

jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

buttonGroup1.add(rbcon);

rbcon.setText("Contado");

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

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

rbconActionPerformed(evt);

});

jPanel1.add(rbcon, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

buttonGroup1.add(rbcre);

rbcre.setText("Credito");

rbcre.addActonListener(new java.awt.event.ActionListener() {

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

rbcreActionPerformed(evt);

});

jPanel1.add(rbcre, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 20, -1, -1));

jLabel8.setText("N de Coutas");

jPanel1.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 20, -1, -1));


txtncoutoas.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.Bevel
Border.LOWERED));

txtncoutoas.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyTyped(java.awt.event.KeyEvent evt) {

txtncoutoasKeyTyped(evt);

});

jPanel1.add(txtncoutoas, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, 50,


20));

getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50,


330, 320, 50));

jLabel4.setText("Total");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(400,


340, -1, -1));

txttotal.setEditable(false);

txttotal.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBord
er.LOWERED));

getContentPane().add(txttotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(450,


340, 70, -1));

btncalcular.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btncalcular.setText("CALCULAR");

btncalcular.addActonListener(new java.awt.event.ActonListener() {

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

btncalcularActionPerformed(evt);

});

getContentPane().add(btncalcular, new org.netbeans.lib.awtextra.AbsoluteConstraints(90,


400, 100, 40));
btnlimpiar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btnlimpiar.setText("BORRAR");

btnlimpiar.addActonListener(new java.awt.event.ActonListener() {

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

btnlimpiarActionPerformed(evt);

});

getContentPane().add(btnlimpiar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(250, 400, 100, 40));

btncerrar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btncerrar.setText("SALIR");

btncerrar.addActionListener(new java.awt.event.ActonListener() {

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

btncerrarActonPerformed(evt);

});

getContentPane().add(btncerrar, new org.netbeans.lib.awtextra.AbsoluteConstraints(410,


400, 90, 40));

jLabel5.setText("Descuento");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20,


470, -1, -1));

txtdes.setEditable(false);

txtdes.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorde
r.LOWERED));

getContentPane().add(txtdes, new org.netbeans.lib.awtextra.AbsoluteConstraints(80, 470,


80, -1));

jLabel6.setText("Incremento");
getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(190,
470, -1, -1));

txtincre.setEditable(false);

txtncre.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBor
der.LOWERED));

getContentPane().add(txtincre, new org.netbeans.lib.awtextra.AbsoluteConstraints(259,


470, 80, -1));

jLabel7.setText("Monto a Pagar");

getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(360,


470, -1, -1));

txtmonto.setEditable(false);

txtmonto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBo
rder.LOWERED));

getContentPane().add(txtmonto, new org.netbeans.lib.awtextra.AbsoluteConstraints(440,


470, 90, -1));

jLabel9.setText("Pago de la Couta");

getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(170,


520, -1, -1));

txtpagocouta.setEditable(false);

txtpagocouta.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.Bev
elBorder.LOWERED));

getContentPane().add(txtpagocouta, new
org.netbeans.lib.awtextra.AbsoluteConstraints(270, 520, 100, 20));

jLabel10.setText("Crditos:");

getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(490,


70, -1, -1));
jLabel11.setText("Crditos:");

getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(200,


70, -1, -1));

pack();

}// </editor-fold>

private void lstcursosValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

indice = lstcursos.getSelectedIndex();

lstcostos.setSelectedIndex(indice);

btnagregar.setEnabled(true);

private void lstcostosValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

indice = lstcostos.getSelectedIndex();

lstcursos.setSelectedIndex(indice);

btnagregar.setEnabled(true);
}

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

// TODO add your handling code here:

if (modelo3.getSize() < 6) {

curso = (String) lstcursos.getSelectedValue();

costo = (String) lstcostos.getSelectedValue();

modelo3.addElement(curso);

modelo4.addElement(costo);

modelo1.removeElement(curso);

modelo2.removeElement(costo);

cuenta = modelo3.size();

for (i = 0; i < cuenta; i++) {


total = total + Integer.parseInt((String) modelo4.elementAt(i));

txttotal.setText(String.valueOf(total));

btnagregar.setEnabled(false);

rbcon.setEnabled(true);

rbcre.setEnabled(true);
} else {

JOptionPane.showMessageDialog(this, "Cantdad de Cursos no permitdos");

private void lstcurselValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

indice = lstcursel.getSelectedIndex();

lstcos.setSelectedIndex(indice);

btneliminar.setEnabled(true);
}

private void lstcosValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

indice = lstcos.getSelectedIndex();

lstcursel.setSelectedIndex(indice);

btneliminar.setEnabled(true);

private void btneliminarActonPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here: curso

= (String) lstcos.getSelectedValue(); costo =

(String) lstcursel.getSelectedValue();
modelo2.addElement(curso);

modelo1.addElement(costo);

modelo4.removeElement(curso);

modelo3.removeElement(costo);

cuenta = modelo3.size();
for (i = 0; i < cuenta; i++) {

total = total + Integer.parseInt((String) modelo4.elementAt(i));

txttotal.setText(String.valueOf(total));

btneliminar.setEnabled(false);

rbcon.setEnabled(true);

rbcre.setEnabled(true);

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

// TODO add your handling code here:

double desc = 0, incre = 0, monto;

int credts, tcredts, total;

credts = Integer.parseInt(txttotal.getText());

total = Integer.parseInt(txttotal.getText());

if (modelo3.getSize() < 5) {

tcredts = credts * 70;

} else {

tcredts = credts * 80;

if (total < 13 && rbcon.isSelected() == true) {

desc = tcredts * 0.05;

} else {

desc = tcredts * 0.07;

}
monto = tcredts - desc;

if (rbcre.isSelected() == true) {

incre = tcredts * 0.08;

monto = tcredts + incre;

} else {

incre = 0.0;

BigDecimal deci1 = new BigDecimal(desc);

deci1 = deci1.setScale(2, RoundingMode.HALF_UP);

BigDecimal deci2 = new BigDecimal(incre);

deci2 = deci2.setScale(2, RoundingMode.HALF_UP);

txtdes.setText(String.valueOf(desc));

txtincre.setText(String.valueOf(incre));

txtmonto.setText(String.valueOf(monto));

txtpagocouta.setText(String.valueOf(incre));

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

// TODO add your handling code here:

Limpiar();

private void btncerrarActionPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

JOptionPane.showMessageDialog(this, "Esta a punto de salir del sistema");

int resp = JOptionPane.showOptionDialog(this, "Elija una opcion", "OPCION",


JOptonPane.YES_NO_OPTION, JOptonPane.QUESTION_MESSAGE, null, new Object[]{"SI",
"NO"}, "NO");

if (resp == 0) {

this.dispose();

}
private void rbconActionPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

if (rbcon.isSelected()) {

btncalcular.setEnabled(true);

txtncoutoas.setEnabled(false);
}

btnlimpiar.setEnabled(true);

private void rbcreActionPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

if (rbcre.isSelected())

{ txtncoutoas.setEnabled(true

); txtncoutoas.requestFocus();

btncalcular.setEnabled(true);
}

btnlimpiar.setEnabled(true);

private void txtncoutoasKeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

char car = evt.getKeyChar();

if (txtncoutoas.getText().length() == 1) {

evt.consume();

if ((car < '2' || car > '6')) {

evt.consume();

}
}

private void txtaluKeyPressed(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

if (evt.getKeyCode() == KeyEvent.VK_ENTER) {

LlenarCosto();

LlenarCursos();

private void txtaluKeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

teclado = evt.getKeyChar();

if (Character.isDigit(teclado))

{ evt.consume();

getToolkit().beep();
}

}
2.-Se quiere llevar a cabo la matricula de los cursos que el alumno indique teniendo en cuenta
que cada curso bsico cuesta 80 soles y cada curso especializado cuesta 110 soles. Muestra el
monto total de los cursos solicitados.

package Matricula;

import javax.swing.DefaultListModel;

public class Curso extends javax.swing.JFrame {

private DefaultListModel modelo1 = new DefaultListModel();

private DefaultListModel modelo3 = new DefaultListModel();

private DefaultListModel modelo4 = new DefaultListModel();

public Curso()

{ initComponents();

setSize(580, 450);

setLocatonRelativeTo(null);

setTitle("CURSOS");
lstcursos.setModel(modelo1);

lstcursel.setModel(modelo3);

lstcos.setModel(modelo4);

btnagregar.setEnabled(false);

btneliminar.setEnabled(false);

btncalcular.setEnabled(false);

public void CursosBasicos() {

modelo1.addElement("Visual Basic");

modelo1.addElement("Power Builder");

modelo1.addElement("Visual Java");
modelo1.addElement("Aplicaciones Web");

modelo1.addElement("Internet");

modelo1.addElement("Aplicatvos");

modelo1.addElement("Herramientas TIC");

public void CursosEspecializados() {

modelo1.addElement("Ingenieria de Software");

modelo1.addElement("Proyecto de BD");

modelo1.addElement("Tesis I");

modelo1.addElement("Costos y Presupuestos");

modelo1.addElement("Estadistca Empresarial");

modelo1.addElement("Inteligencia Artficial");

modelo1.addElement("Programacion Movil");
}

/**

* This method is called from within the constructor to initalize 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() {

buttonGroup1 = new javax.swing.ButtonGroup();

buttonGroup2 = new javax.swing.ButtonGroup();

jScrollPane1 = new javax.swing.JScrollPane();

lstcursos = new javax.swing.JList();

jScrollPane2 = new javax.swing.JScrollPane();

lstcursel = new javax.swing.JList();


jScrollPane4 = new javax.swing.JScrollPane();

lstcos = new javax.swing.JList();

btnagregar = new javax.swing.JButton();

btneliminar = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

btncalcular = new javax.swing.JButton();

lbtotal = new javax.swing.JLabel();

jPanel1 = new javax.swing.JPanel();

rdbbasico = new javax.swing.JRadioButton();

rdbespecial = new javax.swing.JRadioButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("CURSOS");

getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

lstcursos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcursosValueChanged(evt);

});

jScrollPane1.setViewportView(lstcursos);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(20, 100, 200, 190));

lstcursel.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcurselValueChanged(evt);

});

jScrollPane2.setViewportView(lstcursel);
getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(330, 100, 160, 190));

lstcos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {

public void valueChanged(javax.swing.event.ListSelectionEvent evt) {

lstcosValueChanged(evt);

});

jScrollPane4.setViewportView(lstcos);

getContentPane().add(jScrollPane4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 100, 50, 190));

btnagregar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btnagregar.setText("Agregar");

btnagregar.addActonListener(new java.awt.event.ActonListener() {

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

btnagregarActionPerformed(evt);

});

getContentPane().add(btnagregar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(230, 140, 90, 30));

btneliminar.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btneliminar.setText("Quitar");

btneliminar.addActionListener(new java.awt.event.ActonListener() {

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

btneliminarActonPerformed(evt);

});

getContentPane().add(btneliminar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(230, 190, 90, 30));
jLabel4.setText("Total a Pagar:");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(260,


340, -1, -1));

btncalcular.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

btncalcular.setText("CALCULAR MONTO");

btncalcular.addActonListener(new java.awt.event.ActonListener() {

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

btncalcularActionPerformed(evt);

});

getContentPane().add(btncalcular, new org.netbeans.lib.awtextra.AbsoluteConstraints(90,


330, -1, 30));

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

lbtotal.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0,
0)));

getContentPane().add(lbtotal, new org.netbeans.lib.awtextra.AbsoluteConstraints(350,


330, 110, 30));

jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0,
0)));

jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

buttonGroup2.add(rdbbasico); rdbbasico.setText("Cursos

Basicos"); rdbbasico.addActionListener(new

java.awt.event.ActonListener() {

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

rdbbasicoActonPerformed(evt);

});

jPanel1.add(rdbbasico, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, -1, -1));


buttonGroup2.add(rdbespecial); rdbespecial.setText("Cursos

Especializados"); rdbespecial.addActionListener(new

java.awt.event.ActonListener() {
public void actionPerformed(java.awt.event.ActonEvent evt) {

rdbespecialActonPerformed(evt);

});

jPanel1.add(rdbespecial, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 40, -1, -


1));

getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20,


200, 70));

pack();

}// </editor-fold>

private void lstcursosValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

int indice;

indice = lstcursos.getSelectedIndex();

btnagregar.setEnabled(true);

btncalcular.setEnabled(true);

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

// TODO add your handling code here:

String curso;

int cuenta, i, total = 0;

curso = (String) lstcursos.getSelectedValue();

modelo3.addElement(curso);

if (rdbbasico.isSelected() == true) {
modelo4.addElement("80");

} else {

modelo4.addElement("110");

btnagregar.setEnabled(false);

private void lstcurselValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

int indi;

indi = lstcursel.getSelectedIndex();

lstcos.setSelectedIndex(indi);

btneliminar.setEnabled(true);

private void btneliminarActonPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

int indice, i, total = 0;

indice = lstcursel.getSelectedIndex();

modelo3.remove(indice);

modelo4.remove(indice);

btneliminar.setEnabled(false);
}

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

// TODO add your handling code here:

int cuenta, i, total = 0;

cuenta = modelo3.size();

for (i = 0; i < cuenta; i++) {


total = total + Integer.parseInt((String) modelo4.elementAt(i));

lbtotal.setText(String.valueOf(total));

private void lstcosValueChanged(javax.swing.event.ListSelectionEvent evt) {

// TODO add your handling code here:

int indice;

indice = lstcos.getSelectedIndex();

lstcursel.setSelectedIndex(indice);

btneliminar.setEnabled(true);

private void rdbbasicoActonPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

if (rdbbasico.isSelected() == true) {

modelo1.removeAllElements();

CursosBasicos();

private void rdbespecialActonPerformed(java.awt.event.ActonEvent evt) {

// TODO add your handling code here:

if (rdbespecial.isSelected() == true) {

modelo1.removeAllElements();

CursosEspecializados();

/**

* @param args the command line arguments


*/

public statc void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel settng code (optonal) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName())

; break;

} catch (ClassNotFoundException ex) {

java.utl.logging.Logger.getLogger(Curso.class.getName()).log(java.utl.logging.Level.SEVERE,
null, ex);

} catch (InstantatonExcepton ex) {

java.utl.logging.Logger.getLogger(Curso.class.getName()).log(java.utl.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessExcepton ex) {

java.utl.logging.Logger.getLogger(Curso.class.getName()).log(java.utl.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelExcepton ex) {

java.utl.logging.Logger.getLogger(Curso.class.getName()).log(java.utl.logging.Level.SEVERE,
null, ex);

//</editor-fold>

//</editor-fold>
//</editor-fold>

//</editor-fold>

//</editor-fold>

//</editor-fold>

//</editor-fold>

//</editor-fold>

/* Create and display the form */

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

public void run() {

new Curso().setVisible(true);

});

Imajenes de la ejecucin