0% found this document useful (0 votes)
12 views

Java 1

proyecto java 1

Uploaded by

Cesar. C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Java 1

proyecto java 1

Uploaded by

Cesar. C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

EXAMEN FINAL

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Jessica Angeles

*/ public class ExamenFinal extends

javax.swing.JFrame {

/**

* Creates new form ExamenFinal

*/

public ExamenFinal() {

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() {

cbopago = new javax.swing.JComboBox<>();

cboestadocivil = new javax.swing.JComboBox<>();

txtcontrato = new javax.swing.JTextField();

txtestadocivil = new javax.swing.JTextField();

jLabel1 = new javax.swing.JLabel(); jLabel2 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

cbopago.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Contrato", "De


0 a 1500 soles + 20%", "De 1501 a 3000 soles + 10%", "De 3001 a 6000 soles + 5%", "De 6001 soles
a más + 0%" })); cbopago.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbopagoActionPerformed(evt);

});

cboestadocivil.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Estado


Civil", "Soltero + 100 soles de bonificación", "Casado + 150 soles de bonificación" }));
cboestadocivil.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
cboestadocivilActionPerformed(evt);

});

jLabel1.setText("contrato + sueldo neto");

jLabel2.setText("Estado Civil + bonificación");

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

getContentPane().setLayout(layout); layout.setHorizontalGroup(

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

.addGroup(layout.createSequentialGroup()

.addGap(18, 18, 18)

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

.addGroup(layout.createSequentialGroup()

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

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

.addComponent(txtestadocivil, javax.swing.GroupLayout.PREFERRED_SIZE, 320,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(cbopago, javax.swing.GroupLayout.PREFERRED_SIZE, 135,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(cboestadocivil, javax.swing.GroupLayout.PREFERRED_SIZE, 141,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(0, 0, Short.MAX_VALUE))

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

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 135,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtcontrato, javax.swing.GroupLayout.PREFERRED_SIZE, 319,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGap(20, 20, 20))

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addGap(32, 32, 32)

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

.addGap(99, 99, 99)

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

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

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(50, 50, 50)

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

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20,


javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addGap(101, 101, 101))

);

pack();

}// </editor-fold>

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

// TODO add your handling code here: String mensaje

= "El contrado eligido es "; mensaje = mensaje +


cbopago.getSelectedItem().toString();

txtcontrato.setText(mensaje);

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

// TODO add your handling code here: String mensaje = "Su

estado civil es "; mensaje = mensaje +

cboestadocivil.getSelectedItem().toString();

txtestadocivil.setText(mensaje);

/**

* @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(ExamenFinal.class.getName()).log(java.util.logging.Level.SEVERE
, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(ExamenFinal.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

ExamenFinal().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JComboBox<String> cboestadocivil;

private javax.swing.JComboBox<String> cbopago;

private javax.swing.JLabel jLabel1; private

javax.swing.JLabel jLabel2; private

javax.swing.JTextField txtcontrato; private

javax.swing.JTextField txtestadocivil;

// End of variables declaration


}

You might also like