SlideShare una empresa de Scribd logo
INFORME
ESTUDIANTE: GONZALO FARINANGO M. SEMESTRE: SEGUNDO
PARALELO: C PRÁCTICA:24
TEMA:
Desarrollo de nuestro primer programa
OBJETIVO:
-Conocer el desarrollo de un programa en “Eclipse”, para este desarrollo
tendremos que comprender lo que son los formularios en Windows builder.
RESULTADOS DE APRENDIZAJE
-Comprensión de la aplicación de Eclipse.
-Uso correcto del código que aplicaremos en Eclipse.
-Aprender el uso correcto de los formularios
- Aprender a hacer operaciones básicas en un formulario
ACTIVIDADES:
-Realizar un programa en el que se registre y contabilice los votos de las
personas que sufragan.
DESARROLLO DE CONTENIDOS
1. Abrir ECLIPSE.
UNIVERSIDAD CENTRAL DEL ECUADOR
FACULTAD DE FILOSOFIA, LETRAS Y CIENCIAS DE LA EDUCACIÓN
CARRERA DE LA PEDAGOGÍA DE LAS CIENCIAS EXPERIMENTALES
DE LA INFORMÁTICA
2. Seleccionar la dirección en la que queramos guardar nuestro proyecto, en
este caso lo vamos a guardar en Escritorio (Desktop).
3. Creamos un proyecto nuevo de Java.
4. Le ponemos un nombre a nuestro proyecto y le damos clic en Finish.
5. Dentro de nuestro nuevo proyecto crearemos un JFrame, le pondremos
cualquier título.
6. Al crear un JFrame nos aparecerá el siguiente código, aquí podemos empezar a
programar
7. Debemos ir a Design para entrar al formulario
8. Una vez que ingresemos al formulario podemos hacer las modificaciones que
necesitemos
9. En el primer formulario pondremos los siguientes datos:
- 4 botones que digan: Lista 21, Lista 5, Nulo y Blanco
- 2 Label para poner las imágenes de los 2 posibles presidentes
- 1 Botón para imprimir resultados en el segundo formulario
10. En el segundo formulario pondremos los siguientes datos:
- 4 Text Fields en los que se guarden los resultados
- 1 Botón para imprimir resultados en un Text Field
11. En el botón resultados ingresaremos el siguiente código, no olvidemos que
algunos puntos deben estar en público
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su voto");
R1.setText(n);
}
});
btnNewButton.setBounds(57, 103, 119, 38);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("LISTA 1 ");
btnNewButton_1.addActionListener(new ActionListener() {
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R2.setText(n);
}
});
btnNewButton_1.setBounds(251, 103, 101, 38);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("NULO");
btnNewButton_2.addActionListener(new ActionListener() {
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R3.setText(n);
}
});
btnNewButton_2.setBounds(57, 152, 119, 33);
contentPane.add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("BLANCO ");
btnNewButton_3.addActionListener(new ActionListener() {
int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R4.setText(n);
}
});
btnNewButton_3.setBounds(251, 152, 101, 32);
contentPane.add(btnNewButton_3);
JButton btnNewButton_4 = new JButton("RESULTADOS");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
RESULTADOS abrir=new RESULTADOS ();
abrir.setVisible(true);
String inf=R1.getText();
abrir.creo.setText(inf);
String inf2=R2.getText();
abrir.centro.setText(inf2);
String inf3=R3.getText();
abrir.blanco.setText(inf3);
String inf4=R4.getText();
abrir.nulo.setText(inf4);
}
});
btnNewButton_4.setBounds(160, 214, 101, 23);
contentPane.add(btnNewButton_4);
R1 = new JTextField();
R1.setBounds(104, 117, 11, 10);
contentPane.add(R1);
R1.setColumns(10);
R2 = new JTextField();
R2.setBounds(302, 117, 11, 10);
contentPane.add(R2);
R2.setColumns(10);
R3 = new JTextField();
R3.setBounds(104, 163, 11, 10);
contentPane.add(R3);
R3.setColumns(10);
R4 = new JTextField();
R4.setBounds(302, 163, 11, 10);
contentPane.add(R4);
R4.setColumns(10);
T = new JTextField();
T.setBounds(207, 220, 11, 10);
contentPane.add(T);
T.setColumns(10);
12.- En el segundo Formulario también debe estar en público y utilizaremos el
siguiente código
JButton btnNewButton_2 = new JButton("TOTAL");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int a,b,c,d,f;
a=Integer.parseInt(centro.getText());
b=Integer.parseInt(creo.getText());
c=Integer.parseInt(blanco.getText());
d=Integer.parseInt(nulo.getText());
f=a+b+c+d;
t.setText(String.valueOf(f));
13. – Correremos el programa
14.- Por último, dejaré la línea de código que utilicé en el primer formulario:
package cne;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import javax.swing.text.JTextComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
import java.awt.Component;
public class CNE extends JFrame {
private JPanel contentPane;
private JTextField R1;
private JTextField R2;
private JTextField R3;
private JTextField R4;
private JTextField T;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CNE frame = new CNE();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public CNE() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("ELECCIONES ");
lblNewLabel.setBounds(178, 0, 83, 25);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_2 = new JLabel("ARAUZ");
lblNewLabel_2.setIcon(new
ImageIcon("C:UsersmiltoDesktopara.jpg"));
lblNewLabel_2.setBounds(251, 31, 101, 69);
contentPane.add(lblNewLabel_2);
JButton btnNewButton = new JButton("LISTA CREO ");
btnNewButton.addActionListener(new ActionListener() {
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su voto");
R1.setText(n);
}
});
btnNewButton.setBounds(57, 103, 119, 38);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("LISTA 1 ");
btnNewButton_1.addActionListener(new ActionListener() {
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R2.setText(n);
}
});
btnNewButton_1.setBounds(251, 103, 101, 38);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("NULO");
btnNewButton_2.addActionListener(new ActionListener() {
private int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R3.setText(n);
}
});
btnNewButton_2.setBounds(57, 152, 119, 33);
contentPane.add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("BLANCO ");
btnNewButton_3.addActionListener(new ActionListener() {
int count=0;
public void actionPerformed(ActionEvent arg0) {
count ++;
RESULTADOS verRESULTADOS=new RESULTADOS ();
String n=String.valueOf(count);
JOptionPane.showMessageDialog(null,"Gracias por su
voto");
R4.setText(n);
}
});
btnNewButton_3.setBounds(251, 152, 101, 32);
contentPane.add(btnNewButton_3);
JButton btnNewButton_4 = new JButton("RESULTADOS");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
RESULTADOS abrir=new RESULTADOS ();
abrir.setVisible(true);
String inf=R1.getText();
abrir.creo.setText(inf);
String inf2=R2.getText();
abrir.centro.setText(inf2);
String inf3=R3.getText();
abrir.blanco.setText(inf3);
String inf4=R4.getText();
abrir.nulo.setText(inf4);
}
});
btnNewButton_4.setBounds(160, 214, 101, 23);
contentPane.add(btnNewButton_4);
R1 = new JTextField();
R1.setBounds(104, 117, 11, 10);
contentPane.add(R1);
R1.setColumns(10);
R2 = new JTextField();
R2.setBounds(302, 117, 11, 10);
contentPane.add(R2);
R2.setColumns(10);
R3 = new JTextField();
R3.setBounds(104, 163, 11, 10);
contentPane.add(R3);
R3.setColumns(10);
R4 = new JTextField();
R4.setBounds(302, 163, 11, 10);
contentPane.add(R4);
R4.setColumns(10);
T = new JTextField();
T.setBounds(207, 220, 11, 10);
contentPane.add(T);
T.setColumns(10);
JLabel lblNewLabel_3 = new JLabel("LASSO");
lblNewLabel_3.setIcon(new
ImageIcon("C:UsersmiltoDesktoplassodef.jpg"));
lblNewLabel_3.setBounds(75, 28, 101, 75);
contentPane.add(lblNewLabel_3);
}
}
15.- Por último, dejaré la línea de código que utilicé en el segundo formulario:
package cne;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
public class RESULTADOS extends JFrame {
private JPanel contentPane;
public JTextField centro;
public JTextField blanco;
public JTextField nulo;
public JTextField creo;
public JTextField t;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
RESULTADOS frame = new RESULTADOS();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public RESULTADOS() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new JLabel("RESULTADOS FINALES");
lblNewLabel.setBounds(136, 11, 175, 49);
contentPane.add(lblNewLabel);
JLabel lblNewLabel_1 = new JLabel("LISTA CREO");
lblNewLabel_1.setBounds(40, 82, 79, 33);
contentPane.add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("LISTA CINCO");
lblNewLabel_2.setBounds(40, 115, 66, 33);
contentPane.add(lblNewLabel_2);
JLabel lblNewLabel_3 = new JLabel("BLANCOS ");
lblNewLabel_3.setBounds(40, 159, 79, 27);
contentPane.add(lblNewLabel_3);
JLabel lblNewLabel_4 = new JLabel(" NULOS");
lblNewLabel_4.setBounds(40, 197, 46, 14);
contentPane.add(lblNewLabel_4);
centro = new JTextField();
centro.setBounds(136, 121, 86, 20);
contentPane.add(centro);
centro.setColumns(10);
blanco = new JTextField();
blanco.setBounds(136, 162, 86, 20);
contentPane.add(blanco);
blanco.setColumns(10);
nulo = new JTextField();
nulo.setBounds(136, 194, 86, 20);
contentPane.add(nulo);
nulo.setColumns(10);
creo = new JTextField();
creo.setBounds(136, 88, 86, 20);
contentPane.add(creo);
creo.setColumns(10);
t = new JTextField();
t.setBounds(136, 225, 86, 20);
contentPane.add(t);
t.setColumns(10);
JButton btnNewButton = new JButton("REGRESAR");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
CNE abrir= new CNE();
abrir.setVisible(true);
setVisible(false);
}
});
btnNewButton.setBounds(304, 120, 89, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("SALIR");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
btnNewButton_1.setBounds(304, 193, 89, 23);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("TOTAL");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int a,b,c,d,f;
a=Integer.parseInt(centro.getText());
b=Integer.parseInt(creo.getText());
c=Integer.parseInt(blanco.getText());
d=Integer.parseInt(nulo.getText());
f=a+b+c+d;
t.setText(String.valueOf(f));
}
});
btnNewButton_2.setBounds(17, 224, 89, 23);
contentPane.add(btnNewButton_2);
}
}

Más contenido relacionado

La actualidad más candente

Manual escribir en pantalla (autoguardado)
Manual escribir en pantalla (autoguardado)Manual escribir en pantalla (autoguardado)
Manual escribir en pantalla (autoguardado)
Leo Suca Yunga
 
Taller listasyeasygui
Taller listasyeasyguiTaller listasyeasygui
Taller listasyeasygui
Albert Page
 
programas
programasprogramas
Problemas propuesto 1 al12
Problemas propuesto 1 al12Problemas propuesto 1 al12
Problemas propuesto 1 al12
YO Por Que
 
Apuntes10
Apuntes10Apuntes10
Apuntes10
jvicenteg
 
Ejemploc de caso
Ejemploc de casoEjemploc de caso
Ejemploc de caso
dagoberto sierra
 
Ejercisos condicionales 1
Ejercisos condicionales 1Ejercisos condicionales 1
Ejercisos condicionales 1
Iivone Laa UniiCka
 
Ejercicios en Netbeans
Ejercicios en NetbeansEjercicios en Netbeans
Ejercicios en Netbeans
edgar muñoz
 
Explicacion
ExplicacionExplicacion
Explicacion
macorchero001
 
Problemas condicionales
Problemas condicionalesProblemas condicionales
Problemas condicionales
Joshe Varillas
 
Ejemplos Borland C++ Builder
Ejemplos Borland C++ BuilderEjemplos Borland C++ Builder
Ejemplos Borland C++ Builder
Darwin Durand
 
Vbr Awt 01
Vbr Awt 01Vbr Awt 01
Vbr Awt 01
Carlos Luna
 
Elemento n3
Elemento n3Elemento n3
Elemento n3
Marlene Pallo
 
Ejercicios de programacion concurrente
Ejercicios de programacion concurrenteEjercicios de programacion concurrente
Ejercicios de programacion concurrente
edgar muñoz
 
Replica
ReplicaReplica
Replica
FERNANDO
 
Guia para examen java
Guia para examen javaGuia para examen java
Guia para examen java
tecno5
 
creacion de bd en vb
creacion de bd en vbcreacion de bd en vb
creacion de bd en vb
marcelaorduz10
 
Gnuplot
GnuplotGnuplot
Gnuplot
dklajd
 
Teclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªGTeclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªG
andreazocchi2
 

La actualidad más candente (19)

Manual escribir en pantalla (autoguardado)
Manual escribir en pantalla (autoguardado)Manual escribir en pantalla (autoguardado)
Manual escribir en pantalla (autoguardado)
 
Taller listasyeasygui
Taller listasyeasyguiTaller listasyeasygui
Taller listasyeasygui
 
programas
programasprogramas
programas
 
Problemas propuesto 1 al12
Problemas propuesto 1 al12Problemas propuesto 1 al12
Problemas propuesto 1 al12
 
Apuntes10
Apuntes10Apuntes10
Apuntes10
 
Ejemploc de caso
Ejemploc de casoEjemploc de caso
Ejemploc de caso
 
Ejercisos condicionales 1
Ejercisos condicionales 1Ejercisos condicionales 1
Ejercisos condicionales 1
 
Ejercicios en Netbeans
Ejercicios en NetbeansEjercicios en Netbeans
Ejercicios en Netbeans
 
Explicacion
ExplicacionExplicacion
Explicacion
 
Problemas condicionales
Problemas condicionalesProblemas condicionales
Problemas condicionales
 
Ejemplos Borland C++ Builder
Ejemplos Borland C++ BuilderEjemplos Borland C++ Builder
Ejemplos Borland C++ Builder
 
Vbr Awt 01
Vbr Awt 01Vbr Awt 01
Vbr Awt 01
 
Elemento n3
Elemento n3Elemento n3
Elemento n3
 
Ejercicios de programacion concurrente
Ejercicios de programacion concurrenteEjercicios de programacion concurrente
Ejercicios de programacion concurrente
 
Replica
ReplicaReplica
Replica
 
Guia para examen java
Guia para examen javaGuia para examen java
Guia para examen java
 
creacion de bd en vb
creacion de bd en vbcreacion de bd en vb
creacion de bd en vb
 
Gnuplot
GnuplotGnuplot
Gnuplot
 
Teclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªGTeclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªG
 

Similar a 24

Informe#23
Informe#23Informe#23
Informe#23
paulcuenca9
 
22
2222
In 21
In 21In 21
23
2323
Informe#21
Informe#21Informe#21
Informe#21
paulcuenca9
 
Informe#19
Informe#19Informe#19
Informe#19
paulcuenca9
 
21 porta
21 porta21 porta
21 porta
JuanSimbaa8
 
18 por
18 por18 por
18 por
JuanSimbaa8
 
21
2121
18
1818
Formulario u4tema4
Formulario u4tema4Formulario u4tema4
Formulario u4tema4
JeffersonAguachela
 
Pract 5
Pract 5Pract 5
Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)
Carlos Guzmán
 
17
1717
Unidad 4 tema 3
Unidad 4  tema 3Unidad 4  tema 3
Unidad 4 tema 3
JeffersonGuaman10
 
17 por
17 por17 por
17 por
JuanSimbaa8
 
Practica 2
Practica 2Practica 2
Practica 2
StalinNaranjo2
 
Informe#18
Informe#18Informe#18
Informe#18
paulcuenca9
 
In 22
In 22In 22
Informe 4 de formularios
Informe 4 de formulariosInforme 4 de formularios
Informe 4 de formularios
KeevynMoreno
 

Similar a 24 (20)

Informe#23
Informe#23Informe#23
Informe#23
 
22
2222
22
 
In 21
In 21In 21
In 21
 
23
2323
23
 
Informe#21
Informe#21Informe#21
Informe#21
 
Informe#19
Informe#19Informe#19
Informe#19
 
21 porta
21 porta21 porta
21 porta
 
18 por
18 por18 por
18 por
 
21
2121
21
 
18
1818
18
 
Formulario u4tema4
Formulario u4tema4Formulario u4tema4
Formulario u4tema4
 
Pract 5
Pract 5Pract 5
Pract 5
 
Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)
 
17
1717
17
 
Unidad 4 tema 3
Unidad 4  tema 3Unidad 4  tema 3
Unidad 4 tema 3
 
17 por
17 por17 por
17 por
 
Practica 2
Practica 2Practica 2
Practica 2
 
Informe#18
Informe#18Informe#18
Informe#18
 
In 22
In 22In 22
In 22
 
Informe 4 de formularios
Informe 4 de formulariosInforme 4 de formularios
Informe 4 de formularios
 

Más de GonzaloFarinangoMora

-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
GonzaloFarinangoMora
 
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
GonzaloFarinangoMora
 
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdfLa-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
GonzaloFarinangoMora
 
ProgramaciónyRobótica.pdf
ProgramaciónyRobótica.pdfProgramaciónyRobótica.pdf
ProgramaciónyRobótica.pdf
GonzaloFarinangoMora
 
EXAMEN
EXAMENEXAMEN
9
99
8
88
7
77
6
66
5
55
4
44
3
33
1
11
13
1313
12
1212
11
1111
10
1010
9
99
8
88
7
77

Más de GonzaloFarinangoMora (20)

-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
-cumplimiento-de-la-ley-de-ohm-fundamentos-y-aplicaciones-en-circuitos-electr...
 
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
-introduccion-a-la-programacion-basica-aprendiendo-los-fundamentos-de-la-prog...
 
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdfLa-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
La-robotica-definicion-y-relevancia-en-la-actualidad-20230815024858NnuJ.pdf
 
ProgramaciónyRobótica.pdf
ProgramaciónyRobótica.pdfProgramaciónyRobótica.pdf
ProgramaciónyRobótica.pdf
 
EXAMEN
EXAMENEXAMEN
EXAMEN
 
9
99
9
 
8
88
8
 
7
77
7
 
6
66
6
 
5
55
5
 
4
44
4
 
3
33
3
 
1
11
1
 
13
1313
13
 
12
1212
12
 
11
1111
11
 
10
1010
10
 
9
99
9
 
8
88
8
 
7
77
7
 

Último

Business Plan -rAIces - Agro Business Tech
Business Plan -rAIces - Agro Business TechBusiness Plan -rAIces - Agro Business Tech
Business Plan -rAIces - Agro Business Tech
johnyamg20
 
Chatgpt para los Profesores Ccesa007.pdf
Chatgpt para los Profesores Ccesa007.pdfChatgpt para los Profesores Ccesa007.pdf
Chatgpt para los Profesores Ccesa007.pdf
Demetrio Ccesa Rayme
 
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBALMATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
Ana Fernandez
 
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdfFEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
Jose Luis Jimenez Rodriguez
 
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLMExamen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
Juan Martín Martín
 
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdfAPUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
VeronicaCabrera50
 
3° SES COMU LUN10 CUENTO DIA DEL PADRE 933623393 PROF YESSENIA (1).docx
3° SES COMU LUN10  CUENTO DIA DEL PADRE  933623393 PROF YESSENIA (1).docx3° SES COMU LUN10  CUENTO DIA DEL PADRE  933623393 PROF YESSENIA (1).docx
3° SES COMU LUN10 CUENTO DIA DEL PADRE 933623393 PROF YESSENIA (1).docx
rosannatasaycoyactay
 
Clase Prensencial, Actividad 2.pdf.......
Clase Prensencial, Actividad 2.pdf.......Clase Prensencial, Actividad 2.pdf.......
Clase Prensencial, Actividad 2.pdf.......
LuanaJaime1
 
Liturgia día del Padre del siguiente domingo.pptx
Liturgia día del Padre del siguiente domingo.pptxLiturgia día del Padre del siguiente domingo.pptx
Liturgia día del Padre del siguiente domingo.pptx
YeniferGarcia36
 
Evaluacion del tercer trimestre del 2023-2024
Evaluacion del tercer trimestre del 2023-2024Evaluacion del tercer trimestre del 2023-2024
Evaluacion del tercer trimestre del 2023-2024
israelsouza67
 
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdfDESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
JonathanCovena1
 
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docxRETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
100078171
 
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍACINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
Fernández Gorka
 
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdfCronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
RicardoValdiviaVega
 
pueblos originarios de chile presentacion twinkl.pptx
pueblos originarios de chile presentacion twinkl.pptxpueblos originarios de chile presentacion twinkl.pptx
pueblos originarios de chile presentacion twinkl.pptx
RAMIREZNICOLE
 
Presentación simple corporativa degradado en violeta blanco.pdf
Presentación simple corporativa degradado en violeta blanco.pdfPresentación simple corporativa degradado en violeta blanco.pdf
Presentación simple corporativa degradado en violeta blanco.pdf
eleandroth
 
200. Efemerides junio para trabajar en periodico mural
200. Efemerides junio para trabajar en periodico mural200. Efemerides junio para trabajar en periodico mural
200. Efemerides junio para trabajar en periodico mural
shirherrer
 
Presentación de proyecto en acuarela moderna verde.pdf
Presentación de proyecto en acuarela moderna verde.pdfPresentación de proyecto en acuarela moderna verde.pdf
Presentación de proyecto en acuarela moderna verde.pdf
LuanaJaime1
 
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdfCompartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
JimmyDeveloperWebAnd
 
Camus, Albert - El Extranjero.pdf
Camus, Albert -        El Extranjero.pdfCamus, Albert -        El Extranjero.pdf
Camus, Albert - El Extranjero.pdf
AlexDeLonghi
 

Último (20)

Business Plan -rAIces - Agro Business Tech
Business Plan -rAIces - Agro Business TechBusiness Plan -rAIces - Agro Business Tech
Business Plan -rAIces - Agro Business Tech
 
Chatgpt para los Profesores Ccesa007.pdf
Chatgpt para los Profesores Ccesa007.pdfChatgpt para los Profesores Ccesa007.pdf
Chatgpt para los Profesores Ccesa007.pdf
 
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBALMATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
MATERIAL ESCOLAR 2024-2025 3 AÑOS CEIP SAN CRISTÓBAL
 
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdfFEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
FEEDBACK DE LA ESTRUCTURA CURRICULAR- 2024.pdf
 
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLMExamen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
Examen de Selectividad. Geografía junio 2024 (Convocatoria Ordinaria). UCLM
 
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdfAPUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
APUNTES UNIDAD I ECONOMIA EMPRESARIAL .pdf
 
3° SES COMU LUN10 CUENTO DIA DEL PADRE 933623393 PROF YESSENIA (1).docx
3° SES COMU LUN10  CUENTO DIA DEL PADRE  933623393 PROF YESSENIA (1).docx3° SES COMU LUN10  CUENTO DIA DEL PADRE  933623393 PROF YESSENIA (1).docx
3° SES COMU LUN10 CUENTO DIA DEL PADRE 933623393 PROF YESSENIA (1).docx
 
Clase Prensencial, Actividad 2.pdf.......
Clase Prensencial, Actividad 2.pdf.......Clase Prensencial, Actividad 2.pdf.......
Clase Prensencial, Actividad 2.pdf.......
 
Liturgia día del Padre del siguiente domingo.pptx
Liturgia día del Padre del siguiente domingo.pptxLiturgia día del Padre del siguiente domingo.pptx
Liturgia día del Padre del siguiente domingo.pptx
 
Evaluacion del tercer trimestre del 2023-2024
Evaluacion del tercer trimestre del 2023-2024Evaluacion del tercer trimestre del 2023-2024
Evaluacion del tercer trimestre del 2023-2024
 
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdfDESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
DESARROLLO DE LAS RELACIONES CON LOS STAKEHOLDERS.pdf
 
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docxRETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
RETROALIMENTACIÓN PARA EL EXAMEN ÚNICO AUXILIAR DE ENFERMERIA.docx
 
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍACINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
CINE COMO RECURSO DIDÁCTICO para utilizar en TUTORÍA
 
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdfCronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
Cronica-de-una-Muerte-Anunciada - Gabriel Garcia Marquez.pdf
 
pueblos originarios de chile presentacion twinkl.pptx
pueblos originarios de chile presentacion twinkl.pptxpueblos originarios de chile presentacion twinkl.pptx
pueblos originarios de chile presentacion twinkl.pptx
 
Presentación simple corporativa degradado en violeta blanco.pdf
Presentación simple corporativa degradado en violeta blanco.pdfPresentación simple corporativa degradado en violeta blanco.pdf
Presentación simple corporativa degradado en violeta blanco.pdf
 
200. Efemerides junio para trabajar en periodico mural
200. Efemerides junio para trabajar en periodico mural200. Efemerides junio para trabajar en periodico mural
200. Efemerides junio para trabajar en periodico mural
 
Presentación de proyecto en acuarela moderna verde.pdf
Presentación de proyecto en acuarela moderna verde.pdfPresentación de proyecto en acuarela moderna verde.pdf
Presentación de proyecto en acuarela moderna verde.pdf
 
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdfCompartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
Compartir p4s.co Pitch Hackathon Template Plantilla final.pptx-2.pdf
 
Camus, Albert - El Extranjero.pdf
Camus, Albert -        El Extranjero.pdfCamus, Albert -        El Extranjero.pdf
Camus, Albert - El Extranjero.pdf
 

24

  • 1. INFORME ESTUDIANTE: GONZALO FARINANGO M. SEMESTRE: SEGUNDO PARALELO: C PRÁCTICA:24 TEMA: Desarrollo de nuestro primer programa OBJETIVO: -Conocer el desarrollo de un programa en “Eclipse”, para este desarrollo tendremos que comprender lo que son los formularios en Windows builder. RESULTADOS DE APRENDIZAJE -Comprensión de la aplicación de Eclipse. -Uso correcto del código que aplicaremos en Eclipse. -Aprender el uso correcto de los formularios - Aprender a hacer operaciones básicas en un formulario ACTIVIDADES: -Realizar un programa en el que se registre y contabilice los votos de las personas que sufragan. DESARROLLO DE CONTENIDOS 1. Abrir ECLIPSE. UNIVERSIDAD CENTRAL DEL ECUADOR FACULTAD DE FILOSOFIA, LETRAS Y CIENCIAS DE LA EDUCACIÓN CARRERA DE LA PEDAGOGÍA DE LAS CIENCIAS EXPERIMENTALES DE LA INFORMÁTICA
  • 2. 2. Seleccionar la dirección en la que queramos guardar nuestro proyecto, en este caso lo vamos a guardar en Escritorio (Desktop). 3. Creamos un proyecto nuevo de Java. 4. Le ponemos un nombre a nuestro proyecto y le damos clic en Finish.
  • 3. 5. Dentro de nuestro nuevo proyecto crearemos un JFrame, le pondremos cualquier título. 6. Al crear un JFrame nos aparecerá el siguiente código, aquí podemos empezar a programar 7. Debemos ir a Design para entrar al formulario
  • 4. 8. Una vez que ingresemos al formulario podemos hacer las modificaciones que necesitemos 9. En el primer formulario pondremos los siguientes datos: - 4 botones que digan: Lista 21, Lista 5, Nulo y Blanco - 2 Label para poner las imágenes de los 2 posibles presidentes - 1 Botón para imprimir resultados en el segundo formulario 10. En el segundo formulario pondremos los siguientes datos: - 4 Text Fields en los que se guarden los resultados - 1 Botón para imprimir resultados en un Text Field
  • 5. 11. En el botón resultados ingresaremos el siguiente código, no olvidemos que algunos puntos deben estar en público private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R1.setText(n); } }); btnNewButton.setBounds(57, 103, 119, 38); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("LISTA 1 "); btnNewButton_1.addActionListener(new ActionListener() { private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R2.setText(n); } }); btnNewButton_1.setBounds(251, 103, 101, 38); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("NULO"); btnNewButton_2.addActionListener(new ActionListener() { private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count);
  • 6. JOptionPane.showMessageDialog(null,"Gracias por su voto"); R3.setText(n); } }); btnNewButton_2.setBounds(57, 152, 119, 33); contentPane.add(btnNewButton_2); JButton btnNewButton_3 = new JButton("BLANCO "); btnNewButton_3.addActionListener(new ActionListener() { int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R4.setText(n); } }); btnNewButton_3.setBounds(251, 152, 101, 32); contentPane.add(btnNewButton_3); JButton btnNewButton_4 = new JButton("RESULTADOS"); btnNewButton_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { RESULTADOS abrir=new RESULTADOS (); abrir.setVisible(true); String inf=R1.getText(); abrir.creo.setText(inf); String inf2=R2.getText(); abrir.centro.setText(inf2); String inf3=R3.getText(); abrir.blanco.setText(inf3); String inf4=R4.getText(); abrir.nulo.setText(inf4); } }); btnNewButton_4.setBounds(160, 214, 101, 23); contentPane.add(btnNewButton_4); R1 = new JTextField(); R1.setBounds(104, 117, 11, 10); contentPane.add(R1); R1.setColumns(10); R2 = new JTextField(); R2.setBounds(302, 117, 11, 10); contentPane.add(R2); R2.setColumns(10); R3 = new JTextField(); R3.setBounds(104, 163, 11, 10); contentPane.add(R3); R3.setColumns(10); R4 = new JTextField(); R4.setBounds(302, 163, 11, 10); contentPane.add(R4); R4.setColumns(10);
  • 7. T = new JTextField(); T.setBounds(207, 220, 11, 10); contentPane.add(T); T.setColumns(10); 12.- En el segundo Formulario también debe estar en público y utilizaremos el siguiente código JButton btnNewButton_2 = new JButton("TOTAL"); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int a,b,c,d,f; a=Integer.parseInt(centro.getText()); b=Integer.parseInt(creo.getText()); c=Integer.parseInt(blanco.getText()); d=Integer.parseInt(nulo.getText()); f=a+b+c+d; t.setText(String.valueOf(f)); 13. – Correremos el programa 14.- Por último, dejaré la línea de código que utilicé en el primer formulario: package cne; import java.awt.BorderLayout; import java.awt.EventQueue;
  • 8. import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import javax.swing.text.JTextComponent; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ImageIcon; import java.awt.Component; public class CNE extends JFrame { private JPanel contentPane; private JTextField R1; private JTextField R2; private JTextField R3; private JTextField R4; private JTextField T; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { CNE frame = new CNE(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public CNE() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("ELECCIONES "); lblNewLabel.setBounds(178, 0, 83, 25); contentPane.add(lblNewLabel);
  • 9. JLabel lblNewLabel_2 = new JLabel("ARAUZ"); lblNewLabel_2.setIcon(new ImageIcon("C:UsersmiltoDesktopara.jpg")); lblNewLabel_2.setBounds(251, 31, 101, 69); contentPane.add(lblNewLabel_2); JButton btnNewButton = new JButton("LISTA CREO "); btnNewButton.addActionListener(new ActionListener() { private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R1.setText(n); } }); btnNewButton.setBounds(57, 103, 119, 38); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("LISTA 1 "); btnNewButton_1.addActionListener(new ActionListener() { private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R2.setText(n); } }); btnNewButton_1.setBounds(251, 103, 101, 38); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("NULO"); btnNewButton_2.addActionListener(new ActionListener() { private int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R3.setText(n); } }); btnNewButton_2.setBounds(57, 152, 119, 33);
  • 10. contentPane.add(btnNewButton_2); JButton btnNewButton_3 = new JButton("BLANCO "); btnNewButton_3.addActionListener(new ActionListener() { int count=0; public void actionPerformed(ActionEvent arg0) { count ++; RESULTADOS verRESULTADOS=new RESULTADOS (); String n=String.valueOf(count); JOptionPane.showMessageDialog(null,"Gracias por su voto"); R4.setText(n); } }); btnNewButton_3.setBounds(251, 152, 101, 32); contentPane.add(btnNewButton_3); JButton btnNewButton_4 = new JButton("RESULTADOS"); btnNewButton_4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { RESULTADOS abrir=new RESULTADOS (); abrir.setVisible(true); String inf=R1.getText(); abrir.creo.setText(inf); String inf2=R2.getText(); abrir.centro.setText(inf2); String inf3=R3.getText(); abrir.blanco.setText(inf3); String inf4=R4.getText(); abrir.nulo.setText(inf4); } }); btnNewButton_4.setBounds(160, 214, 101, 23); contentPane.add(btnNewButton_4); R1 = new JTextField(); R1.setBounds(104, 117, 11, 10); contentPane.add(R1); R1.setColumns(10); R2 = new JTextField(); R2.setBounds(302, 117, 11, 10); contentPane.add(R2); R2.setColumns(10); R3 = new JTextField(); R3.setBounds(104, 163, 11, 10); contentPane.add(R3); R3.setColumns(10);
  • 11. R4 = new JTextField(); R4.setBounds(302, 163, 11, 10); contentPane.add(R4); R4.setColumns(10); T = new JTextField(); T.setBounds(207, 220, 11, 10); contentPane.add(T); T.setColumns(10); JLabel lblNewLabel_3 = new JLabel("LASSO"); lblNewLabel_3.setIcon(new ImageIcon("C:UsersmiltoDesktoplassodef.jpg")); lblNewLabel_3.setBounds(75, 28, 101, 75); contentPane.add(lblNewLabel_3); } } 15.- Por último, dejaré la línea de código que utilicé en el segundo formulario: package cne; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.ImageIcon; public class RESULTADOS extends JFrame { private JPanel contentPane; public JTextField centro; public JTextField blanco; public JTextField nulo; public JTextField creo; public JTextField t; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { RESULTADOS frame = new RESULTADOS(); frame.setVisible(true); } catch (Exception e) {
  • 12. e.printStackTrace(); } } }); } /** * Create the frame. */ public RESULTADOS() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new JLabel("RESULTADOS FINALES"); lblNewLabel.setBounds(136, 11, 175, 49); contentPane.add(lblNewLabel); JLabel lblNewLabel_1 = new JLabel("LISTA CREO"); lblNewLabel_1.setBounds(40, 82, 79, 33); contentPane.add(lblNewLabel_1); JLabel lblNewLabel_2 = new JLabel("LISTA CINCO"); lblNewLabel_2.setBounds(40, 115, 66, 33); contentPane.add(lblNewLabel_2); JLabel lblNewLabel_3 = new JLabel("BLANCOS "); lblNewLabel_3.setBounds(40, 159, 79, 27); contentPane.add(lblNewLabel_3); JLabel lblNewLabel_4 = new JLabel(" NULOS"); lblNewLabel_4.setBounds(40, 197, 46, 14); contentPane.add(lblNewLabel_4); centro = new JTextField(); centro.setBounds(136, 121, 86, 20); contentPane.add(centro); centro.setColumns(10); blanco = new JTextField(); blanco.setBounds(136, 162, 86, 20); contentPane.add(blanco); blanco.setColumns(10); nulo = new JTextField(); nulo.setBounds(136, 194, 86, 20); contentPane.add(nulo); nulo.setColumns(10); creo = new JTextField(); creo.setBounds(136, 88, 86, 20);
  • 13. contentPane.add(creo); creo.setColumns(10); t = new JTextField(); t.setBounds(136, 225, 86, 20); contentPane.add(t); t.setColumns(10); JButton btnNewButton = new JButton("REGRESAR"); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { CNE abrir= new CNE(); abrir.setVisible(true); setVisible(false); } }); btnNewButton.setBounds(304, 120, 89, 23); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("SALIR"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); btnNewButton_1.setBounds(304, 193, 89, 23); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("TOTAL"); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int a,b,c,d,f; a=Integer.parseInt(centro.getText()); b=Integer.parseInt(creo.getText()); c=Integer.parseInt(blanco.getText()); d=Integer.parseInt(nulo.getText()); f=a+b+c+d; t.setText(String.valueOf(f)); } }); btnNewButton_2.setBounds(17, 224, 89, 23); contentPane.add(btnNewButton_2); } }