FORMULARIO 2
ELECCIÓN DE CARRERAS
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author CBTIS73
*/
public class EleccionDeCarreras extends javax.swing.JFrame {
void aceptar(){
String mensaje=("Carreras Elegidas:");
if(chkDerecho.isSelected()){
mensaje= mensaje+"Derecho";
}
if(chkSistemas.isSelected()){
mensaje= mensaje+"Sistemas";
}
if(chkContab.isSelected()){
mensaje= mensaje+"Contabilidad";
}
if(chkEcono.isSelected()){
mensaje= mensaje+"Economia";
}
lblRespuesta.setText(mensaje);
}
void limpiar(){
lblRespuesta.setText("");
if (chkDerecho.isSelected()){
chkDerecho.setSelected(false);
}
if(chkContab.isSelected()){
chkSistemas.setSelected(false);
}
if(chkContab.isSelected()){
chkContab.setSelected(false);
}
if (chkEcono.isSelected()){
chkEcono.setSelected(false);
}
}
/**
* Creates new form EleccionDeCarreras
*/
public EleccionDeCarreras() {
initComponents();
}
/**
* 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() {
jLabel1 = new javax.swing.JLabel();
chkDerecho = new javax.swing.JCheckBox();
chkSistemas = new javax.swing.JCheckBox();
chkContab = new javax.swing.JCheckBox();
chkEcono = new javax.swing.JCheckBox();
btnAceptar = new javax.swing.JButton();
btnNuevo = new javax.swing.JButton();
lblRespuesta = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setForeground(new java.awt.Color(153, 0, 153));
jLabel1.setText("Eleccion de carreras");
chkDerecho.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
chkDerecho.setForeground(new java.awt.Color(0, 153, 153));
chkDerecho.setText("Derecho");
chkDerecho.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
chkDerechoActionPerformed(evt);
}
});
chkSistemas.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
chkSistemas.setForeground(new java.awt.Color(0, 204, 204));
chkSistemas.setText("Sistemas");
chkContab.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
chkContab.setForeground(new java.awt.Color(0, 102, 102));
chkContab.setText("Contabilidad");
chkEcono.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
chkEcono.setForeground(new java.awt.Color(0, 153, 102));
chkEcono.setText("Economia");
btnAceptar.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnAceptar.setText("Aceptar");
btnAceptar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAceptarActionPerformed(evt);
}
});
btnNuevo.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnNuevo.setText("Nuevo");
btnNuevo.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNuevoActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(132, 132, 132)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(89, 89, 89)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(chkSistemas)
.addComponent(chkDerecho)
.addComponent(chkContab)
.addComponent(chkEcono)))
.addGroup(layout.createSequentialGroup()
.addGap(54, 54, 54)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblRespuesta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(btnAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41)
.addComponent(btnNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap(85, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(chkDerecho)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chkSistemas)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chkContab)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(chkEcono)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnAceptar)
.addGroup(layout.createSequentialGroup()
.addComponent(btnNuevo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(1, 1, 1)))
.addGap(26, 26, 26)
.addComponent(lblRespuesta, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(19, 19, 19))
);
pack();
}// </editor-fold>
private void chkDerechoActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {
aceptar(); // TODO add your handling code here:
}
private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {
limpiar(); // TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* 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.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EleccionDeCarreras.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new EleccionDeCarreras().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnAceptar;
private javax.swing.JButton btnNuevo;
private javax.swing.JCheckBox chkContab;
private javax.swing.JCheckBox chkDerecho;
private javax.swing.JCheckBox chkEcono;
private javax.swing.JCheckBox chkSistemas;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel lblRespuesta;
// End of variables declaration
}