SlideShare una empresa de Scribd logo
1 de 13
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 listasyeasyguiAlbert Page
 
Problemas propuesto 1 al12
Problemas propuesto 1 al12Problemas propuesto 1 al12
Problemas propuesto 1 al12YO Por Que
 
Ejercicios en Netbeans
Ejercicios en NetbeansEjercicios en Netbeans
Ejercicios en Netbeansedgar muñoz
 
Problemas condicionales
Problemas condicionalesProblemas condicionales
Problemas condicionalesJoshe Varillas
 
Ejemplos Borland C++ Builder
Ejemplos Borland C++ BuilderEjemplos Borland C++ Builder
Ejemplos Borland C++ BuilderDarwin Durand
 
Ejercicios de programacion concurrente
Ejercicios de programacion concurrenteEjercicios de programacion concurrente
Ejercicios de programacion concurrenteedgar muñoz
 
Guia para examen java
Guia para examen javaGuia para examen java
Guia para examen javatecno5
 
Gnuplot
GnuplotGnuplot
Gnuplotdklajd
 
Teclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªGTeclado Andrea Zocchi 1ªG
Teclado Andrea Zocchi 1ªGandreazocchi2
 

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

GLOSAS Y PALABRAS ACTO 2 DE ABRIL 2024.docx
GLOSAS  Y PALABRAS ACTO 2 DE ABRIL 2024.docxGLOSAS  Y PALABRAS ACTO 2 DE ABRIL 2024.docx
GLOSAS Y PALABRAS ACTO 2 DE ABRIL 2024.docxAleParedes11
 
Introducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleIntroducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleJonathanCovena1
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdfDemetrio Ccesa Rayme
 
La Función tecnológica del tutor.pptx
La  Función  tecnológica  del tutor.pptxLa  Función  tecnológica  del tutor.pptx
La Función tecnológica del tutor.pptxJunkotantik
 
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxSINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxlclcarmen
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PCCesarFernandez937857
 
Clasificaciones, modalidades y tendencias de investigación educativa.
Clasificaciones, modalidades y tendencias de investigación educativa.Clasificaciones, modalidades y tendencias de investigación educativa.
Clasificaciones, modalidades y tendencias de investigación educativa.José Luis Palma
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxlclcarmen
 
Lecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadLecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadAlejandrino Halire Ccahuana
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Carlos Muñoz
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.amayarogel
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónLourdes Feria
 
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfSELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfAngélica Soledad Vega Ramírez
 
Manual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfManual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfMaryRotonda1
 
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARO
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARONARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARO
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFAROJosé Luis Palma
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoFundación YOD YOD
 
programa dia de las madres 10 de mayo para evento
programa dia de las madres 10 de mayo  para eventoprograma dia de las madres 10 de mayo  para evento
programa dia de las madres 10 de mayo para eventoDiegoMtsS
 
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfResolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfDemetrio Ccesa Rayme
 

Último (20)

GLOSAS Y PALABRAS ACTO 2 DE ABRIL 2024.docx
GLOSAS  Y PALABRAS ACTO 2 DE ABRIL 2024.docxGLOSAS  Y PALABRAS ACTO 2 DE ABRIL 2024.docx
GLOSAS Y PALABRAS ACTO 2 DE ABRIL 2024.docx
 
Introducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo SostenibleIntroducción:Los objetivos de Desarrollo Sostenible
Introducción:Los objetivos de Desarrollo Sostenible
 
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdfPlanificacion Anual 4to Grado Educacion Primaria   2024   Ccesa007.pdf
Planificacion Anual 4to Grado Educacion Primaria 2024 Ccesa007.pdf
 
La Función tecnológica del tutor.pptx
La  Función  tecnológica  del tutor.pptxLa  Función  tecnológica  del tutor.pptx
La Función tecnológica del tutor.pptx
 
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptxSINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
SINTAXIS DE LA ORACIÓN SIMPLE 2023-2024.pptx
 
Identificación de componentes Hardware del PC
Identificación de componentes Hardware del PCIdentificación de componentes Hardware del PC
Identificación de componentes Hardware del PC
 
Clasificaciones, modalidades y tendencias de investigación educativa.
Clasificaciones, modalidades y tendencias de investigación educativa.Clasificaciones, modalidades y tendencias de investigación educativa.
Clasificaciones, modalidades y tendencias de investigación educativa.
 
Sesión de clase: Defendamos la verdad.pdf
Sesión de clase: Defendamos la verdad.pdfSesión de clase: Defendamos la verdad.pdf
Sesión de clase: Defendamos la verdad.pdf
 
Defendamos la verdad. La defensa es importante.
Defendamos la verdad. La defensa es importante.Defendamos la verdad. La defensa es importante.
Defendamos la verdad. La defensa es importante.
 
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptxTIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
TIPOLOGÍA TEXTUAL- EXPOSICIÓN Y ARGUMENTACIÓN.pptx
 
Lecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdadLecciones 04 Esc. Sabática. Defendamos la verdad
Lecciones 04 Esc. Sabática. Defendamos la verdad
 
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
Plan Refuerzo Escolar 2024 para estudiantes con necesidades de Aprendizaje en...
 
La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.La triple Naturaleza del Hombre estudio.
La triple Naturaleza del Hombre estudio.
 
Estrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcciónEstrategia de prompts, primeras ideas para su construcción
Estrategia de prompts, primeras ideas para su construcción
 
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdfSELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
SELECCIÓN DE LA MUESTRA Y MUESTREO EN INVESTIGACIÓN CUALITATIVA.pdf
 
Manual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdfManual - ABAS II completo 263 hojas .pdf
Manual - ABAS II completo 263 hojas .pdf
 
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARO
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARONARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARO
NARRACIONES SOBRE LA VIDA DEL GENERAL ELOY ALFARO
 
Heinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativoHeinsohn Privacidad y Ciberseguridad para el sector educativo
Heinsohn Privacidad y Ciberseguridad para el sector educativo
 
programa dia de las madres 10 de mayo para evento
programa dia de las madres 10 de mayo  para eventoprograma dia de las madres 10 de mayo  para evento
programa dia de las madres 10 de mayo para evento
 
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdfResolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.pdf
Resolucion de Problemas en Educacion Inicial 5 años ED-2024 Ccesa007.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); } }