0% found this document useful (0 votes)
16 views94 pages

Practica de Javaa

Uploaded by

briantpaulino459
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)
16 views94 pages

Practica de Javaa

Uploaded by

briantpaulino459
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/ 94

TAREA SOBRE JAVA

NOMBRE: BRIANT

APELLIDO: PAULINO TOLENTINO

MATRICULA: 2024-0101

MAESTRO: FREIDY PEREZ


TAREA SOBRE JAVA

TAREA JAVA TEMA DISEÑO.

Realizar los ejercicios usando los mismos diseños mostrados.

1-Vamos a crear un imitador, como si fuera un espejo. Tendremos dos pares de


conjunto de elementos separados (puedes usar un separador) y cuando nosotros
pinchamos en un elemento o escribimos en un campo, se debe cambiar el otro
lado.

Por ejemplo, si yo tengo un campo de texto y escribo en él, el campo de texto que
es su reflejo también recibirá ese texto.

Puedes usar los elementos que quieras, ejemplo: JTextField, JRadioButton,


JCheckBox, JTextArea, JSpinner, etc.

Solo puedes modificar de un lado, el otro conjunto no lo podéis modificar, es decir,


que no es bidireccional.

package com.mycompany.tareabuil;

public class BUIls extends javax.swing.JFrame {


TAREA SOBRE JAVA

public BUIls() { initComponents();

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

grupo1 = new javax.swing.ButtonGroup(); grupo2


= new javax.swing.ButtonGroup(); grupos1 = new
javax.swing.ButtonGroup(); grupos2 = new

javax.swing.ButtonGroup(); jInternalFrame1 = new


javax.swing.JInternalFrame(); boton1 = new

javax.swing.JRadioButton(); jLabel1 = new


javax.swing.JLabel(); jLabel2 = new
javax.swing.JLabel(); boton2 = new
javax.swing.JRadioButton(); boton3 = new
javax.swing.JRadioButton(); jCheckBox1 = new

javax.swing.JCheckBox(); jCheckBox2 = new


javax.swing.JCheckBox(); jCheckBox3 = new

javax.swing.JCheckBox(); text1 = new


javax.swing.JFormattedTextField(); jComboBox1 =
new javax.swing.JComboBox<>(); jp3 = new

javax.swing.JSpinner(); jDesktopPane1 = new


javax.swing.JDesktopPane(); jDesktopPane2 = new

javax.swing.JDesktopPane(); boton11 = new


javax.swing.JRadioButton(); boton22
TAREA SOBRE JAVA

= new javax.swing.JRadioButton(); boton33 =

new javax.swing.JRadioButton(); botton1 =

new javax.swing.JCheckBox(); botton2 =

new javax.swing.JCheckBox(); botton3 =

new javax.swing.JCheckBox(); jp2 = new

javax.swing.JComboBox<>(); jSpinner2 =

new javax.swing.JSpinner(); text2 = new

javax.swing.JTextField(); jLabel3 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jInternalFrame1.setVisible(true);

boton1.setText("Opcion 1");

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

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

boton1ActionPerformed(evt);

});

jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 24)); // NOI18N

jLabel1.setText("Imitador");

jLabel2.setText("Original");

boton2.setText("Opcion 2");
TAREA SOBRE JAVA

boton2.addActionListener(new java.awt.event.ActionListener() { public

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

boton2ActionPerformed(evt);

});

boton3.setText("Opcion 3");

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

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


boton3ActionPerformed(evt);

});

jCheckBox1.setText("Opcion 4");

jCheckBox1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCheckBox1ActionPerformed(evt);

});

jCheckBox2.setText("Opcion 5");

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

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

jCheckBox2ActionPerformed(evt);

});

jCheckBox3.setText("Opcion 6");
TAREA SOBRE JAVA

jCheckBox3.addActionListener(new java.awt.event.ActionListener() { public

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

jCheckBox3ActionPerformed(evt);

});

text1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

text1ActionPerformed(evt);

});

jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"Item 1", "Item 2", "Item 3", "Item 4" }));

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

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

jComboBox1ActionPerformed(evt);

});

jp3.addChangeListener(new javax.swing.event.ChangeListener() {

public void stateChanged(javax.swing.event.ChangeEvent evt) {

jp3StateChanged(evt);

});

jDesktopPane1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
TAREA SOBRE JAVA

boton11.setText("Opcion1"); boton11.setBorderPainted(true);

boton11.setContentAreaFilled(false); boton11.setCursor(new

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

boton11.setEnabled(false); boton11.setFocusable(false);

boton22.setText("Opcion2"); boton22.setEnabled(false);

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

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

boton22ActionPerformed(evt);

});

boton33.setText("Opcion3");

boton33.setEnabled(false); boton33.addActionListener(new
java.awt.event.ActionListener() { public void

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

boton33ActionPerformed(evt);

});

botton1.setText("Opcion4");

botton1.setEnabled(false); botton1.addActionListener(new

java.awt.event.ActionListener() { public void

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

botton1ActionPerformed(evt);

});
TAREA SOBRE JAVA

botton2.setText("Opcion5");

botton2.setEnabled(false);

botton2.addActionListener(new java.awt.event.ActionListener() { public

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

botton2ActionPerformed(evt);

});

botton3.setText("Opcion6");

botton3.setEnabled(false);

jp2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1",


"Item 2", "Item 3", "Item 4" })); jp2.setEnabled(false);

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

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

jp2ActionPerformed(evt);

});

jSpinner2.setEnabled(false);

text2.setEnabled(false); text2.addActionListener(new

java.awt.event.ActionListener() { public void


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

text2ActionPerformed(evt);

});

jLabel3.setText("Espejo");
TAREA SOBRE JAVA

jDesktopPane2.setLayer(boton11, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(boton22, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(boton33, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(botton1, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(botton2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(botton3, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(jp2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(jSpinner2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(text2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane2.setLayer(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);

javax.swing.GroupLayout jDesktopPane2Layout = new


javax.swing.GroupLayout(jDesktopPane2);
jDesktopPane2.setLayout(jDesktopPane2Layout);
jDesktopPane2Layout.setHorizontalGroup(

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

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addComponent(boton22,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)
TAREA SOBRE JAVA

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

.addComponent(botton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addComponent(boton33,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(botton3,
javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addComponent(boton11,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(botton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addGap(27, 27, 27)

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addComponent(jSpinner2,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jp2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
TAREA SOBRE JAVA

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addGap(18, 18, 18)


.addComponent(text2, javax.swing.GroupLayout.PREFERRED_SIZE,
102, javax.swing.GroupLayout.PREFERRED_SIZE))))

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 37,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(32, Short.MAX_VALUE))

);
jDesktopPane2Layout.setVerticalGroup(
jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)

.addGroup(jDesktopPane2Layout.createSequentialGroup()

.addComponent(jLabel3)

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

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.BASELINE)

.addComponent(boton11)

.addComponent(botton1)
.addComponent(text2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.BASELINE)

.addComponent(boton22)

.addComponent(botton2)

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

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
TAREA SOBRE JAVA

.addGroup(jDesktopPane2Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.BASELINE)

.addComponent(boton33)

.addComponent(botton3)
.addComponent(jSpinner2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(175, Short.MAX_VALUE))

);

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(

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

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jInternalFrame1Layout.createSequentialGroup()
.addComponent(boton3, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(6, 6, 6)
.addComponent(jCheckBox3, javax.swing.GroupLayout.PREFERRED_SIZE,
85, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(44, 44, 44)

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()
TAREA SOBRE JAVA

.addComponent(boton1, javax.swing.GroupLayout.PREFERRED_SIZE, 98,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(6, 6, 6)
.addComponent(jCheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
85, javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(text1)))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(19, 19, 19)

.addComponent(jLabel2)

.addGap(95, 95, 95)

.addComponent(jLabel1))

.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(boton2, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(6, 6, 6)

.addComponent(jCheckBox2,
javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(28, 28, 28)

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

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(jDesktopPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
TAREA SOBRE JAVA

.addComponent(jDesktopPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

);

jInternalFrame1Layout.setVerticalGroup(

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(7, 7, 7)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(13, 13, 13)

.addComponent(jLabel2))

.addComponent(jLabel1))

.addGap(6, 6, 6)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(1, 1, 1)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(boton1)

.addComponent(jCheckBox1))))

.addGap(6, 6, 6)
TAREA SOBRE JAVA

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(1, 1, 1)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(boton2)

.addComponent(jCheckBox2))))
.addGap(6, 6, 6)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(1, 1, 1)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(boton3)

.addComponent(jCheckBox3))))

.addGap(18, 18, 18)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

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

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

.addContainerGap(67, Short.MAX_VALUE))
TAREA SOBRE JAVA

);

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(20, 20, 20)

.addComponent(jInternalFrame1)

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

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

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

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

this.boton33.setSelected(true);

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

// TODO add your handling code here: this.botton1.setSelected(true);


TAREA SOBRE JAVA

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

// TODO add your handling code here: this.text2.setText(this.text1.getText());

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

// TODO add your handling code here:

this.boton22.setSelected(true);

grupo1.add(boton2);

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

// TODO add your handling code here:

this.boton11.setSelected(true);

grupo1.add(boton1);

grupo1.add(boton2); grupo1.add(boton3);

grupos1.add(boton11);

grupos1.add(boton22); grupos1.add(boton33);

grupos2.add(botton1); grupos2.add(botton2);
grupos2.add(botton3);

}
TAREA SOBRE JAVA

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

// TODO add your handling code here:

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

// TODO add your handling code here:

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

// TODO add your handling code here:

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

// TODO add your handling code here:

this.botton2.setSelected(true);

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

// TODO add your handling code here: this.botton3.setSelected(true);

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

// TODO add your handling code here:

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

// TODO add your handling code here:

this.jp2.setSelectedIndex(this.jComboBox1.getSelectedIndex());
TAREA SOBRE JAVA

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

// TODO add your handling code here:

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

// TODO add your handling code here:

private void jp3StateChanged(javax.swing.event.ChangeEvent evt) {


// TODO add your handling code here:

this.jSpinner2.setValue((Integer)this.jp3.getValue());

/**

* @param args the command line arguments

*/

public static void main(String args[]) {


try { for

(javax.swing.UIManager.LookAndFeelInfo info :

javax.swing.UIManager.getInstalledLookAndFeels()) { if

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

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

break;

}
TAREA SOBRE JAVA

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(BUIls.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(BUIls.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(BUIls.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(BUIls.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

//</editor-fold>

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

public void run() { new

BUIls().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JRadioButton boton1; private


javax.swing.JRadioButton boton11; private

javax.swing.JRadioButton boton2; private


TAREA SOBRE JAVA

javax.swing.JRadioButton boton22; private


javax.swing.JRadioButton boton3; private
javax.swing.JRadioButton boton33; private

javax.swing.JCheckBox botton1; private

javax.swing.JCheckBox botton2; private


javax.swing.JCheckBox botton3; private

javax.swing.ButtonGroup grupo1; private


javax.swing.ButtonGroup grupo2; private

javax.swing.ButtonGroup grupos1; private


javax.swing.ButtonGroup grupos2; private
javax.swing.JCheckBox jCheckBox1; private
javax.swing.JCheckBox jCheckBox2; private
javax.swing.JCheckBox jCheckBox3; private

javax.swing.JComboBox<String> jComboBox1; private


javax.swing.JDesktopPane jDesktopPane1; private

javax.swing.JDesktopPane jDesktopPane2; private


javax.swing.JInternalFrame jInternalFrame1; private
javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel2; private javax.swing.JLabel jLabel3; private
javax.swing.JSpinner jSpinner2; private

javax.swing.JComboBox<String> jp2; private


javax.swing.JSpinner jp3; private

javax.swing.JFormattedTextField text1; private


javax.swing.JTextField text2;

// End of variables declaration

}
TAREA SOBRE JAVA
TAREA SOBRE JAVA

2-Crea un generador de números gráfico. Nosotros escribiremos seleccionaremos


dos números en unos JSpinner (contadores) y se nos mostrara en un JTextField, el
número generado entre esos dos números, al pulsar en el botón. El JTextField no
debe ser editable.

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit


this template

*/

package com.mycompany.fake;

/**

* @author ccarl

*/
TAREA SOBRE JAVA

public class generador extends javax.swing.JFrame {

/**

* Creates new form generador

*/

public generador() {

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

jInternalFrame1 = new javax.swing.JInternalFrame(); jLabel1

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

jLabel3 = new javax.swing.JLabel();

numero1 = new javax.swing.JSpinner(); numero2


TAREA SOBRE JAVA

= new javax.swing.JSpinner(); jButton1 = new

javax.swing.JButton(); jLabel4 = new

javax.swing.JLabel(); jTextField1 = new

javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jInternalFrame1.setVisible(true);

jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N

jLabel1.setText("Generador de Numeros");

jLabel2.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

jLabel2.setText("Numero 1");

jLabel3.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

jLabel3.setText("Numero 2");

jButton1.setText("Generar"); jButton1.addActionListener(new

java.awt.event.ActionListener() { public void

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

jButton1ActionPerformed(evt);

}
TAREA SOBRE JAVA

});

jLabel4.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

jLabel4.setText("Numero generado");

jTextField1.setEnabled(false);

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(

jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)

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

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(jButton1)

.addGap(65, 65, 65))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(87, 87, 87)

.addComponent(jLabel1))
TAREA SOBRE JAVA

.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addContainerGap()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.LEADING)

.addComponent(jLabel2)

.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 64,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(42, 42, 42)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.LEADING, false)

.addComponent(numero2,
javax.swing.GroupLayout.DEFAULT_SIZE, 88, Short.MAX_VALUE)

.addComponent(numero1)))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(19, 19, 19)

.addComponent(jLabel4)

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

.addComponent(jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE, 71,
javax.swing.GroupLayout.PREFERRED_SIZE)))

.addContainerGap(91, Short.MAX_VALUE))

);

jInternalFrame1Layout.setVerticalGroup(
TAREA SOBRE JAVA

jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel1)

.addGap(34, 34, 34)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.BASELINE)

.addComponent(jLabel2)

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

.addGap(18, 18, 18)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.BASELINE)

.addComponent(jLabel3)

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

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

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.A
lignment.BASELINE)

.addComponent(jLabel4)
TAREA SOBRE JAVA

.addComponent(jTextField1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(22, 22, 22)

.addComponent(jButton1)

.addGap(33, 33, 33))

);

javax.swing.GroupLayout layout = new

javax.swing.GroupLayout(getContentPane());

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

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

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addComponent(jInternalFrame1)

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addComponent(jInternalFrame1)

.addContainerGap())

);

pack();
TAREA SOBRE JAVA

}// </editor-fold>

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

// TODO add your handling code here:

int suma;

int n1; int n2;

n1 = (int) numero1.getValue(); n2 =

(int) numero2.getValue(); suma= n1+n2;

jTextField1.setText(Integer.toString(suma));

/**

* @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) ">
TAREA SOBRE JAVA

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

} catch (InstantiationException ex) {


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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(generador.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
TAREA SOBRE JAVA

//</editor-fold>

/* Create and display the form */

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

public void run() { new generador().setVisible(true);

});

// Variables declaration - do not modify private

javax.swing.JButton jButton1; private

javax.swing.JInternalFrame jInternalFrame1; private

javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2; private

javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel4; private

javax.swing.JTextField jTextField1; private

javax.swing.JSpinner numero1; private

javax.swing.JSpinner numero2;

// End of variables declaration

}
TAREA SOBRE JAVA

3-Crea una mini encuesta gráfica. Daremos una serie de opciones para que el
usuario elija. La encuesta preguntará lo siguiente:

▪ Elije un sistema operativo (solo una opción, JRadioButton)

▪ Windows

▪ Linux

▪ Mac
▪ Elije tu especialidad (pueden seleccionar ninguna o varias opciones,
JCheckBox)

▪ Programación

▪ Diseño gráfico

▪ Administración
▪ Horas dedicadas en el ordenador (usaremos un slider entre 0 y 10) Para
el slider, recomiendo usar un JLabel, que diga qué valor tiene el slider,
TAREA SOBRE JAVA

usar el evento stateChanged.y al final mostrar un mensaje similar al que


está debajo de la primera imagen.

Vetna1

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this


template

*/

package com.mycompany.ventanas;

/**

*
TAREA SOBRE JAVA

* @author ccarl

*/

public class Ventana1 extends javax.swing.JFrame {

/**

* Creates new form Ventana1

*/
public Ventana1() {

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

grupo = new javax.swing.ButtonGroup(); grupo2


= new javax.swing.ButtonGroup(); jInternalFrame1 =
new javax.swing.JInternalFrame(); jLabel1 = new
javax.swing.JLabel(); jLabel2 = new
javax.swing.JLabel(); jRadioButton1 = new
javax.swing.JRadioButton(); jRadioButton2 = new
javax.swing.JRadioButton(); jRadioButton3 = new
javax.swing.JRadioButton(); jLabel3 = new
javax.swing.JLabel(); jCheckBox1 = new
TAREA SOBRE JAVA

javax.swing.JCheckBox(); jCheckBox2 = new


javax.swing.JCheckBox(); jCheckBox3 = new
javax.swing.JCheckBox(); jLabel4 = new
javax.swing.JLabel(); jSlider1 = new
javax.swing.JSlider(); jButton1 = new
javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

addWindowListener(new java.awt.event.WindowAdapter() { public void

windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt);

});

jInternalFrame1.setVisible(true);

jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 24)); // NOI18N

jLabel1.setText("Mini encuensta");

jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N

jLabel2.setText("Eleige el sistema operativo:"); jRadioButton1.setText("Windows");

jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void

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

jRadioButton1ActionPerformed(evt);

});

jRadioButton2.setText("Linux");

jRadioButton2.addActionListener(new java.awt.event.ActionListener() {
TAREA SOBRE JAVA

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

jRadioButton2ActionPerformed(evt);

});

jRadioButton3.setText("Mac");

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

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

jRadioButton3ActionPerformed(evt);

});

jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N

jLabel3.setText("Elige tu especialidad");

jCheckBox1.setText("Programacion");
jCheckBox1.addActionListener(new java.awt.event.ActionListener() {

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

jCheckBox1ActionPerformed(evt);

});

jCheckBox2.setText("Diseno Grafico");

jCheckBox3.setText("Administracion");

jCheckBox3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {

jCheckBox3ActionPerformed(evt);
TAREA SOBRE JAVA

});

jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N

jLabel4.setText("Horas dedicadas en el ordenador"); jSlider1.setMajorTickSpacing(1);

jSlider1.setMaximum(10); jSlider1.setMinimum(1);

jSlider1.setMinorTickSpacing(1); jSlider1.setPaintLabels(true);

jSlider1.addChangeListener(new javax.swing.event.ChangeListener() { public void

stateChanged(javax.swing.event.ChangeEvent evt) { jSlider1StateChanged(evt);

});

jButton1.setText("Generar");
jButton1.addActionListener(new java.awt.event.ActionListener() {

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


jButton1ActionPerformed(evt);

});

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
TAREA SOBRE JAVA

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(169, 169, 169)

.addComponent(jButton1))
.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(164, 164, 164)

.addComponent(jLabel1))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(16, 16, 16)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(jRadioButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2)

.addComponent(jRadioButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jRadioButton3,
javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addContainerGap()

.addComponent(jLabel3))
.addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE,
85, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel4)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addContainerGap()
.addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE,
479, javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(jCheckBox1)
TAREA SOBRE JAVA

.addComponent(jCheckBox3, javax.swing.GroupLayout.PREFERRED_SIZE,
117, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(18, Short.MAX_VALUE))

);

jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel1)

.addGap(29, 29, 29)

.addComponent(jLabel2)

.addGap(18, 18, 18)

.addComponent(jRadioButton1)

.addGap(18, 18, 18)

.addComponent(jRadioButton2)

.addGap(18, 18, 18)

.addComponent(jRadioButton3)

.addGap(18, 18, 18)

.addComponent(jLabel3)

.addGap(18, 18, 18)

.addComponent(jCheckBox1)

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

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

.addComponent(jCheckBox3)

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

.addComponent(jLabel4)
TAREA SOBRE JAVA

.addGap(28, 28, 28)


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

.addGap(18, 18, 18)

.addComponent(jButton1)

.addContainerGap(46, Short.MAX_VALUE))

);

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

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

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

.addComponent(jInternalFrame1)

);

layout.setVerticalGroup(

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

.addComponent(jInternalFrame1)

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

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


// TODO add your handling code here: Ventana2 v2= new
Ventana2(); v2.setVisible(true); this.setVisible(false);
v2.sistema=jRadioButton1.getText();
TAREA SOBRE JAVA

v2.sistema=jRadioButton2.getText(); v2.sistema=jRadioButton3.getText();

v2.Pro=jCheckBox1.getText();

v2.Pro=jCheckBox2.getText(); v2.Pro=jCheckBox3.getText();

if (jRadioButton1.isSelected()== true)

v2.sistema="windows";

else

if(jRadioButton2.isSelected()== true)

v2.sistema="Linux";

else if

(jRadioButton3.isSelected()==true)

v2.sistema="Mac"; else

if(jCheckBox1.isSelected()==true)

v2.Pro= "progrmacion"; else

if(jCheckBox2.isSelected()==true)

v2.Pro= "diseno grafico"; else

if(jCheckBox3.isSelected()==true)

v2.Pro="administracion";

v2.horas= jSlider1.getValue();
TAREA SOBRE JAVA

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

// TODO add your handling code here:

private void formWindowActivated(java.awt.event.WindowEvent evt) {

// TODO add your handling code here


grupo.add(jRadioButton1);
grupo.add(jRadioButton2);
grupo.add(jRadioButton3); grupo2.add(jCheckBox1);
grupo2.add(jCheckBox2); grupo2.add(jCheckBox3);

private void jSlider1StateChanged(javax.swing.event.ChangeEvent evt) {

// TODO add your handling code here:


TAREA SOBRE JAVA

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

// TODO add your handling code here:

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

// TODO add your handling code here:

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

// 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 :
TAREA SOBRE JAVA

javax.swing.UIManager.getInstalledLookAndFeels()) { if
("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

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

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

//</editor-fold>

/* Create and display the form */


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

public void run() { new

Ventana1().setVisible(true);

}
TAREA SOBRE JAVA

});

// Variables declaration - do not modify private


javax.swing.ButtonGroup grupo; private
javax.swing.ButtonGroup grupo2; private javax.swing.JButton
jButton1; private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2; private
javax.swing.JCheckBox jCheckBox3; private
javax.swing.JInternalFrame jInternalFrame1; private
javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel2; private javax.swing.JLabel jLabel3; private
javax.swing.JLabel jLabel4; private javax.swing.JRadioButton
jRadioButton1; private javax.swing.JRadioButton
jRadioButton2; private javax.swing.JRadioButton
jRadioButton3; private javax.swing.JSlider jSlider1;

// End of variables declaration

Ventana2

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this


template

*/

package com.mycompany.ventanas;

/**
TAREA SOBRE JAVA

* @author ccarl

*/

public class Ventana2 extends javax.swing.JFrame {

/**

* Creates new form Ventana2

*/
public Ventana2() {

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

jProgressBar1 = new javax.swing.JProgressBar();


jLabel1 = new javax.swing.JLabel(); jButton1 = new
javax.swing.JButton(); jDesktopPane1 = new
javax.swing.JDesktopPane(); jLabel2 = new
javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel(); opcion1 = new
TAREA SOBRE JAVA

javax.swing.JLabel(); opcion2 = new


javax.swing.JLabel(); opcion3 = new
javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXI
T_ON_CLOSE); addWindowListener(new
java.awt.event.WindowAdapter() { public void
windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);

});

jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N

jLabel1.setText("Muestra Datos");

jButton1.setText("OK"); jButton1.addActionListener(new

java.awt.event.ActionListener() { public void


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

jButton1ActionPerformed(evt);

});

jLabel2.setText("Tu sistema operativo preferido es");

jLabel3.setText("Tu especialidad es ");

jLabel4.setText("y el numero de hora es dedicadas en el ordenador es");


TAREA SOBRE JAVA

jDesktopPane1.setLayer(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane1.setLayer(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane1.setLayer(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane1.setLayer(opcion1, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane1.setLayer(opcion2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jDesktopPane1.setLayer(opcion3, javax.swing.JLayeredPane.DEFAULT_LAYER);
javax.swing.GroupLayout jDesktopPane1Layout = new

javax.swing.GroupLayout(jDesktopPane1);
jDesktopPane1.setLayout(jDesktopPane1Layout);
jDesktopPane1Layout.setHorizontalGroup(

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

.addGroup(jDesktopPane1Layout.createSequentialGroup()

.addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addComponent(jLabel3)

.addGroup(jDesktopPane1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING, false)

.addGroup(jDesktopPane1Layout.createSequentialGroup()

.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 197,
javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addComponent(opcion1,
javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE))
TAREA SOBRE JAVA

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE,
296, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(opcion3, javax.swing.GroupLayout.PREFERRED_SIZE,
97, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jDesktopPane1Layout.createSequentialGroup()

.addGap(119, 119, 119)

.addComponent(opcion2, javax.swing.GroupLayout.PREFERRED_SIZE,
93, javax.swing.GroupLayout.PREFERRED_SIZE)))

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

);

jDesktopPane1Layout.setVerticalGroup(

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

.addGroup(jDesktopPane1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.TRAILING)

.addComponent(jLabel2)
.addComponent(opcion1, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(12, 12, 12)

.addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.LEADING)

.addComponent(jLabel3)
.addComponent(opcion2, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)


TAREA SOBRE JAVA

.addGroup(jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignmen
t.BASELINE)

.addComponent(jLabel4)
.addComponent(opcion3, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(18, Short.MAX_VALUE))

);

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

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

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

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,

layout.createSequentialGroup()

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

.addComponent(jButton1)

.addGap(26, 26, 26))

.addGroup(layout.createSequentialGroup()

.addGap(104, 104, 104)

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

.addComponent(jDesktopPane1)

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()
TAREA SOBRE JAVA

.addGap(22, 22, 22)

.addComponent(jLabel1)

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

.addComponent(jDesktopPane1)

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

.addComponent(jButton1)

.addGap(89, 89, 89))

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

this.setVisible(false);

String sistema,Pro ; int

horas ;

private void formWindowActivated(java.awt.event.WindowEvent evt) {


// TODO add your handling code here: opcion1.setText(sistema); opcion2.setText(Pro);

opcion3.setIconTextGap(horas);

/**

* @param args the command line arguments


TAREA SOBRE JAVA

*/

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(Ventana2.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (InstantiationException ex) {

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

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

//</editor-fold>
TAREA SOBRE JAVA

/* Create and display the form */


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

public void run() { new

Ventana2().setVisible(true);

});

// Variables declaration - do not modify private


javax.swing.JButton jButton1; private
javax.swing.JDesktopPane jDesktopPane1; private
javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel2; private javax.swing.JLabel jLabel3; private
javax.swing.JLabel jLabel4; private
javax.swing.JProgressBar jProgressBar1; private
javax.swing.JLabel opcion1; private javax.swing.JLabel
opcion2; private javax.swing.JLabel opcion3;
// End of variables declaration }
TAREA SOBRE JAVA
TAREA SOBRE JAVA

4-Crea una simple lista de películas. tendremos un JComboBox, donde almacenaremos


las películas, que vayamos almacenando en un campo de texto. Al pulsar el botón
Añadir la película que hayamos metido, se introducirá en el JComboBox
TAREA SOBRE JAVA

package com.mycompany.tareabuil;

/**

* @author ccarl

*/

public class Buil_2 extends javax.swing.JFrame {

/**

* Creates new form Buil_2

*/ public

Buil_2() {

initComponents();

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {


TAREA SOBRE JAVA

jInternalFrame2 = new javax.swing.JInternalFrame();

jLabel6 = new javax.swing.JLabel(); jLabel5 =


new javax.swing.JLabel(); jTextField2 = new

javax.swing.JTextField(); jComboBox1 = new


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

javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jInternalFrame2.setVisible(true);

jLabel6.setText("Peliculas");

jLabel5.setText("Escribe el nombre de la Pelicula");

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

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

jComboBox1ActionPerformed(evt);

});

jButton1.setText("Agregar");

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

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

jButton1ActionPerformed(evt);

});
TAREA SOBRE JAVA

javax.swing.GroupLayout jInternalFrame2Layout = new


javax.swing.GroupLayout(jInternalFrame2.getContentPane());
jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout);
jInternalFrame2Layout.setHorizontalGroup(
jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)

.addGroup(jInternalFrame2Layout.createSequentialGroup()

.addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame2Layout.createSequentialGroup()

.addGap(152, 152, 152)

.addComponent(jLabel6))

.addGroup(jInternalFrame2Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel5))

.addGroup(jInternalFrame2Layout.createSequentialGroup()

.addGap(22, 22, 22)

.addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(jButton1)

.addGroup(jInternalFrame2Layout.createSequentialGroup()

.addComponent(jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE, 97,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(90, 90, 90)

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

.addContainerGap(107, Short.MAX_VALUE))

);
TAREA SOBRE JAVA

jInternalFrame2Layout.setVerticalGroup(

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

.addGroup(jInternalFrame2Layout.createSequentialGroup()
.addComponent(jLabel6)

.addGap(27, 27, 27)

.addComponent(jLabel5)

.addGap(18, 18, 18)

.addGroup(jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(30, 30, 30)

.addComponent(jButton1)

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

);

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

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

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

.addComponent(jInternalFrame2)

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addComponent(jInternalFrame2,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
TAREA SOBRE JAVA

javax.swing.GroupLayout.PREFERRED_SIZE)

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

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

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


// TODO add your handling code here: String datos=jTextField2.getText();

jComboBox1.addItem(datos); jTextField2.setText("");

jTextField2.requestFocus();

/**

* @param args the command line arguments

*/

public static void main(String args[]) {


try { for
(javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) { if
("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}
TAREA SOBRE JAVA

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Buil_2.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Buil_2.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Buil_2.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Buil_2.class.getName()).log(java.util.logging.Level.SEV
ERE, null, ex);

//</editor-fold>

/* Create and display the form */


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

public void run() { new

Buil_2().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton jButton1; private

javax.swing.JComboBox<String> jComboBox1;

private javax.swing.JInternalFrame jInternalFrame2;


TAREA SOBRE JAVA

private javax.swing.JLabel jLabel5; private

javax.swing.JLabel jLabel6; private

javax.swing.JTextField jTextField2;

// End of variables declaration

Jframe

Venta1

El diseño de estos ejercicios es decisión de ustedes.


5-Una biblioteca maneja libros, algunos de ellos son originales y otros son fotocopias. No
todos los libros se prestan. a) Crear la clase Libro b) Agregar atributos: título, original y
prestable c) Agregar métodos de instancia: ‘getOriginal’, ‘getTitulo’ y ‘getPrestable’. d)
Agregar métodos de instancia ' esOriginal' y ' sePresta' que retornen el valor booleano
correspondiente. e) Agregar métodos de instancia ‘setTítulo’ , ‘setOriginal’ y ‘setPrestable’
f) Crear un método main en una clase para prueba que permita obtener 2 instancias de
Libro, uno de ellos es original y no se presta, el otro es fotocopia y se presta. Utilizar los
métodos de instancia para realizar estas operaciones. Mostrar los libros

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license
TAREA SOBRE JAVA

* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template

*/

package com.mycompany.app;

/**

* @author ccarl

*/

public class Libro { private

String titulo; private boolean


original; private boolean

prestable;

public Libro(String titulo, boolean original, boolean prestable) {


this.titulo = titulo; this.original = original; this.prestable

= prestable;

Libro() {
throw new UnsupportedOperationException("Not supported yet."); // Generated from
nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody

// Métodos getters public

boolean getOriginal() { return

original;

}
TAREA SOBRE JAVA

public String getTitulo() { return

titulo;

public boolean getPrestable() {

return prestable;

// Métodos de instancia

public boolean esOriginal() {

return original;

public boolean sePresta() {

return prestable;

// Métodos setters public void

setTitulo(String titulo) { this.titulo

= titulo;

public void setOriginal(boolean original) {

this.original = original;

public void setPrestable(boolean prestable) {

this.prestable = prestable;
TAREA SOBRE JAVA

Ventana1

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this


template

*/

package com.mycompany.app;

/**

* @author ccarl

*/

public class Biblioteca extends javax.swing.JFrame {

/**

* Creates new form Biblioteca

*/ public
Biblioteca() {

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.
TAREA SOBRE JAVA

*/

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

grup1 = new javax.swing.ButtonGroup(); grup2 =


new javax.swing.ButtonGroup(); grup3 = new
javax.swing.ButtonGroup(); jButton1 = new
javax.swing.JButton(); jInternalFrame1 = new
javax.swing.JInternalFrame(); op1 = new
javax.swing.JRadioButton(); op2 = new
javax.swing.JRadioButton(); op3 = new
javax.swing.JRadioButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jButton1.setText("Mostrar Libro");

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

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

jButton1ActionPerformed(evt);

});

jInternalFrame1.setVisible(true);

op1.setText("El Principe");

op2.setText("Don quijote de la mancha");


TAREA SOBRE JAVA

op3.setText("Dos de agua");

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)

.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(op1, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(op2)
.addComponent(op3, javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(205, Short.MAX_VALUE))

);

jInternalFrame1Layout.setVerticalGroup(

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(23, 23, 23)

.addComponent(op1)

.addGap(36, 36, 36)

.addComponent(op2)
TAREA SOBRE JAVA

.addGap(29, 29, 29)

.addComponent(op3)

.addContainerGap(123, Short.MAX_VALUE))

);

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(143, 143, 143)

.addComponent(jButton1))

.addGroup(layout.createSequentialGroup()

.addContainerGap()

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

.addContainerGap(98, Short.MAX_VALUE))

);

layout.setVerticalGroup(

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

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

.addComponent(jInternalFrame1,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
151, Short.MAX_VALUE)
TAREA SOBRE JAVA

.addComponent(jButton1)

.addGap(46, 46, 46))

);

pack();

}// </editor-fold>

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

// TODO add your handling code here:

Libro libro3 = new Libro("El Quijote", true, false); ventana

v2= new ventana(); v2.setVisible(true);

grup1.add(op1); grup2.add(op2);

grup3.add(op3);

this.setVisible(false); v2.t2=op1.getText();
v2.t1=op1.getText();
v2.O2=op1.getText();
v2.C2=op1.getText();

v2.A2=op1.getText();

// mostras mientras que...


if (op1.isSelected()== true) v2.t1="El

pricipe";
TAREA SOBRE JAVA

if (op1.isSelected()== true)

v2.A2="Nicalas Maquiabelo"; if

(op1.isSelected()== true) v2.O2="si";

if (op1.isSelected()== true) v2.C2="no";

else if
(op2.isSelected()== true) v2.t1="Don
quijote de la mancha"; if
(op2.isSelected()==true)
v2.A2="Miguel de Cervantes";

if (op2.isSelected()== true) v2.O2="No";

if (op2.isSelected()== true) v2.C2="si";

else if (op3.isSelected()== true)

v2.t1="Dos pesos de agua";

if (op3.isSelected()== true)
v2.A2="Juan bosh"; if
(op3.isSelected()== true)
v2.O2="no"; if
(op3.isSelected()== true)
v2.C2="si";
TAREA SOBRE JAVA

/**

* @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) {


TAREA SOBRE JAVA

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

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Biblioteca.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Biblioteca.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

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

//</editor-fold>

/* Create and display the form */


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

public void run() {

new Biblioteca().setVisible(true);

});

// Variables declaration - do not modify


private javax.swing.ButtonGroup grup1; private
javax.swing.ButtonGroup grup2; private
javax.swing.ButtonGroup grup3; private
javax.swing.JButton jButton1; private
javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JRadioButton op1; private
TAREA SOBRE JAVA

javax.swing.JRadioButton op2; private

javax.swing.JRadioButton op3;

// End of variables declaration

Ventana2

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this


template

*/

package com.mycompany.app;

/**

* @author ccarl

*/

public class ventana extends javax.swing.JFrame {

/**

* Creates new form ventana

*/ public
ventana() {

initComponents();

/**
TAREA SOBRE JAVA

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

jInternalFrame1 = new
javax.swing.JInternalFrame(); txtTitulo = new
javax.swing.JLabel(); txtAutor = new
javax.swing.JLabel(); txtOriginal = new
javax.swing.JLabel(); txtCopia = new
javax.swing.JLabel(); jLabel1 = new

javax.swing.JLabel(); jLabel2 = new


javax.swing.JLabel(); jLabel3 = new
javax.swing.JLabel(); jLabel4 = new
javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() { public void

windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt);

});

jInternalFrame1.setVisible(true);

jLabel1.setText("Titulo:");
TAREA SOBRE JAVA

jLabel2.setText("Autor:");

jLabel3.setText("Original:");

jLabel4.setText("Prestable:");

javax.swing.GroupLayout jInternalFrame1Layout = new


javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE,
140, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE,
TAREA SOBRE JAVA

105, javax.swing.GroupLayout.PREFERRED_SIZE)))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(13, 13, 13)

.addComponent(jLabel3)

.addGap(22, 22, 22))


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

.addContainerGap()

.addComponent(jLabel4)

.addGap(6, 6, 6)))

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(txtOriginal,
javax.swing.GroupLayout.PREFERRED_SIZE, 71,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(txtCopia,
javax.swing.GroupLayout.PREFERRED_SIZE, 71,
javax.swing.GroupLayout.PREFERRED_SIZE))))

.addContainerGap(186, Short.MAX_VALUE))

);

jInternalFrame1Layout.setVerticalGroup(

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

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(16, 16, 16)


TAREA SOBRE JAVA

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(jLabel1)
.addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(28, 28, 28)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING)

.addComponent(jLabel3)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING)

.addComponent(txtAutor,
javax.swing.GroupLayout.PREFERRED_SIZE, 16,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

.addGap(73, 73, 73))))

.addGroup(jInternalFrame1Layout.createSequentialGroup()

.addGap(101, 101, 101)


.addComponent(txtOriginal, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
23, Short.MAX_VALUE)

.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)

.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(txtCopia, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 16,
TAREA SOBRE JAVA

javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(63, 63, 63))

);

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

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

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

.addComponent(jInternalFrame1)

);

layout.setVerticalGroup(

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

.addComponent(jInternalFrame1)

);

pack();

}// </editor-fold> String t1,t2,A2,O2,C2; private

void formWindowActivated(java.awt.event.WindowEvent evt) {

// TODO add your handling code here:

txtTitulo.setText(t1);
txtAutor.setText(A2);
txtOriginal.setText(O2);
txtCopia.setText(C2);

}
TAREA SOBRE JAVA

/**

* @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.swi
ng.UIMan
ager.Look
AndFeelIn
fo info :
javax.swi
ng.UIMan
ager.getIn
stalledLoo
kAndFeel
s()) { if
("Nimbus"
.equals(in

fo.getNa

me())) {
javax.swing.UI

Manager.setL

ookAndFeel(in
TAREA SOBRE JAVA

fo.getClassNa

me());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(ventana.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);

//</editor-fold>

/* Create and display the form */


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

public void run() { new

ventana().setVisible(true);

});

}
TAREA SOBRE JAVA

// Variables declaration - do not modify private


javax.swing.JInternalFrame jInternalFrame1; private
javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel2; private javax.swing.JLabel jLabel3; private
javax.swing.JLabel jLabel4; private javax.swing.JLabel
txtAutor; private javax.swing.JLabel txtCopia; private
javax.swing.JLabel txtOriginal; private javax.swing.JLabel
txtTitulo;

// End of variables declaration

}
TAREA SOBRE JAVA
TAREA SOBRE JAVA

creado
s

6-Crear la clase Triángulo. Debe incluir los siguientes métodos que devuelven un valor
booleano:

a) esEscaleno

b) esIsósceles

c) esEquilátero

d) tieneAnguloRecto

Agregar el código necesario para probarla.

Clase

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license

* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this


template

*/
TAREA SOBRE JAVA

package com.mycompany.app.newpackage;
public class Trinangulo { private double

lado1; private double lado2; private double

lado3;

public Trinangulo(double lado1, double lado2, double lado3) {


this.lado1 = lado1; this.lado2 = lado2; this.lado3 =
lado3;

public boolean esEscaleno() { return (lado1 != lado2) &&

(lado1 != lado3) && (lado2 != lado3);

public boolean esIsósceles() { return (lado1 == lado2) ||

(lado1 == lado3) || (lado2 == lado3);

public boolean esEquilátero() { return

(lado1 == lado2) && (lado1 == lado3);

public boolean tieneAnguloRecto() { double

a = lado1 * lado1; double b = lado2 * lado2;

double c = lado3 * lado3; return (a + b == c) ||

(a + c == b) || (b + c == a);

}
TAREA SOBRE JAVA

Jframe

/*

* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change


this license

* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this


template

*/

package com.mycompany.app.newpackage;

import com.mycompany.app.newpackage.Trinangulo; import

javax.swing.JOptionPane;

/**

* @author ccarl

*/

public class Triangulo extends javax.swing.JFrame {

/**

* Creates new form Triangulo

*/ public
Triangulo() {

initComponents();

}
TAREA SOBRE JAVA

/**

* 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();


jLabel2 = new javax.swing.JLabel(); jLabel3
= new javax.swing.JLabel(); T1

= new javax.swing.JLabel();
T2 = new javax.swing.JLabel(); T3 = new
javax.swing.JLabel(); jLabel7 = new
javax.swing.JLabel(); T4 = new
javax.swing.JLabel(); jTextField1 = new
javax.swing.JTextField(); jTextField2 = new
javax.swing.JTextField(); jButton1 = new
javax.swing.JButton(); jTextField3 = new
javax.swing.JTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText("lado1");

jLabel2.setText("lado2");

jLabel3.setText("lado3");
TAREA SOBRE JAVA

T1.setText("escanelo");

T2.setText("isoseles");

T3.setText("equilatero");

jLabel7.setText("jLabel7");

T4.setText("tiene un angulo recto");

jButton1.setText("Verificar Trinagulo");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);

});

jTextField3.setText("jTextField3");

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(28, 28, 28)

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

.addGroup(layout.createSequentialGroup()
TAREA SOBRE JAVA

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(207, 207, 207)

.addComponent(jTextField2,

javax.swing.GroupLayout.PREFERRED_SIZE, 281,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
37, javax.swing.GroupLayout.PREFERRED_SIZE))

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

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

.addGroup(layout.createSequentialGroup()
.addComponent(T4, javax.swing.GroupLayout.PREFERRED_SIZE,
121, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(53, 53, 53)

.addComponent(jTextField1,
javax.swing.GroupLayout.DEFAULT_SIZE, 295, Short.MAX_VALUE))

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel7,
javax.swing.GroupLayout.PREFERRED_SIZE, 37,
javax.swing.GroupLayout.PREFERRED_SIZE)

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

.addGroup(layout.createSequentialGroup()

.addComponent(T2)

.addGap(218, 218, 218)


TAREA SOBRE JAVA

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

.addComponent(jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE, 71,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)

.addComponent(T3, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 57, Short.MAX_VALUE)
.addComponent(T1, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)))

.addContainerGap())

);

layout.setVerticalGroup(

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

.addGroup(layout.createSequentialGroup()

.addGap(30, 30, 30)

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

.addComponent(jLabel1)

.addComponent(jLabel7))

.addGap(28, 28, 28)

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

.addComponent(jLabel2)

.addComponent(T4)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(45, 45, 45)


TAREA SOBRE JAVA

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

.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(32, 32, 32)


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

.addGap(5, 5, 5)

.addComponent(T1)

.addGap(41, 41, 41)

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

.addComponent(T2)

.addComponent(jButton1))
.addGap(28, 28, 28)

.addComponent(T3)

.addContainerGap(76, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

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

// TODO add your handling code here: try { double lado1 =

Double.parseDouble(jTextField1.getText()); double lado2 =

Double.parseDouble(jTextField2.getText()); double lado3 =

Double.parseDouble(jTextField3.getText());

Trinangulo triangulo1 = new Trinangulo(lado1, lado2, lado3);


TAREA SOBRE JAVA

T1.setText(String.valueOf(triangulo1.esEscaleno()));

T2.setText(String.valueOf(triangulo1.esIsósceles()));

T3.setText(String.valueOf(triangulo1.esEquilátero()));

T4.setText(String.valueOf(triangulo1.tieneAnguloRecto()));

} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Por favor, ingrese valores numéricos
válidos para los lados del triángulo.", "Error", JOptionPane.ERROR_MESSAGE);

/**

* @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) {


TAREA SOBRE JAVA

java.util.logging.Logger.getLogger(Triangulo.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Triangulo.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);

} catch (IllegalAccessException ex) {

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

} catch (javax.swing.UnsupportedLookAndFeelException ex) {


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

//</editor-fold>

/* Create and display the form */


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

public void run() { new

Triangulo().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JLabel T1; private

javax.swing.JLabel T2; private

javax.swing.JLabel T3; private

javax.swing.JLabel T4; private

javax.swing.JButton jButton1; private

javax.swing.JLabel jLabel1; private


TAREA SOBRE JAVA

javax.swing.JLabel jLabel2; private

javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel7; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JTextField jTextField3;

// End of variables declaration

7. Un club tiene socios.

a) Crear la clase Socio con variables de instancia: nombre, número y variable de Clase:
PróximoNúmero.

b) Agregar los métodos de acceso y modificación

c) Inicializar en 1 el próximo número.

d) Crear un socio, mostrar sus datos

e) Crear otro socio, mostrar sus datos

You might also like