SlideShare una empresa de Scribd logo
1 de 13
INFORME
ESTUDIANTE: Jefferson Paul Cuenca Tenecela 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.
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);
voto");
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
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);
voto");
});
JOptionPane.showMessageDialog(null,"Gracias por su
R3.setText(n);
}
btnNewButton_2.setBounds(57, 152, 119, 33);
contentPane.add(btnNewButton_2);
voto");
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
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,
contentPane.add(R3);
11, 10);
R3.setColumns(10);
R4 = new JTextField();
R4.setBounds(302, 163,
contentPane.add(R4);
11, 10);
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);
voto");
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
R2.setText(n);
}
});
btnNewButton_1.setBounds(251, 103, 101, 38);
contentPane.add(btnNewButton_1);
voto");
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
R3.setText(n);
}
});
btnNewButton_2.setBounds(57, 152, 119, 33);
voto");
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
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

La actualidad más candente (20)

Unid 4 tema 4
Unid 4  tema 4Unid 4  tema 4
Unid 4 tema 4
 
Informe Tecnico Topicos Avanzados de Programacion
 Informe Tecnico Topicos Avanzados de Programacion Informe Tecnico Topicos Avanzados de Programacion
Informe Tecnico Topicos Avanzados de Programacion
 
Unidad 4 tema 3
Unidad 4  tema 3Unidad 4  tema 3
Unidad 4 tema 3
 
Informe 4 de formularios
Informe 4 de formulariosInforme 4 de formularios
Informe 4 de formularios
 
Manual marichuy
Manual marichuyManual marichuy
Manual marichuy
 
21 porta
21 porta21 porta
21 porta
 
Manual de usuario
Manual de usuarioManual de usuario
Manual de usuario
 
Copilacion de ejercicios en java
Copilacion de ejercicios en javaCopilacion de ejercicios en java
Copilacion de ejercicios en java
 
Proyecto de un formulario de facturacion
Proyecto de un formulario de facturacionProyecto de un formulario de facturacion
Proyecto de un formulario de facturacion
 
5. Interacción con el usuario: eventos y formularios
5. Interacción con el usuario: eventos y formularios5. Interacción con el usuario: eventos y formularios
5. Interacción con el usuario: eventos y formularios
 
Reporte unidad3
Reporte unidad3Reporte unidad3
Reporte unidad3
 
Fundamentos de Programación Visual Basic 2010
Fundamentos de Programación Visual Basic 2010Fundamentos de Programación Visual Basic 2010
Fundamentos de Programación Visual Basic 2010
 
21
2121
21
 
18 por
18 por18 por
18 por
 
Informe#18
Informe#18Informe#18
Informe#18
 
6. Utilización del modelo de objetos del documento (DOM)
6. Utilización del modelo de objetos del documento (DOM)6. Utilización del modelo de objetos del documento (DOM)
6. Utilización del modelo de objetos del documento (DOM)
 
Manual(mario alberto rosales lara)
Manual(mario alberto rosales lara)Manual(mario alberto rosales lara)
Manual(mario alberto rosales lara)
 
Problemas propuestos2.0
Problemas propuestos2.0Problemas propuestos2.0
Problemas propuestos2.0
 
Cristinagananparedes
CristinagananparedesCristinagananparedes
Cristinagananparedes
 
Pract 5
Pract 5Pract 5
Pract 5
 

Similar a Informe#25 (20)

In 21
In 21In 21
In 21
 
Mp mardoqueo informe tecnico tap
Mp mardoqueo informe tecnico tapMp mardoqueo informe tecnico tap
Mp mardoqueo informe tecnico tap
 
Informe#21
Informe#21Informe#21
Informe#21
 
Elecciones (informe 23)
Elecciones (informe 23)Elecciones (informe 23)
Elecciones (informe 23)
 
Informe u4 tema3.1.1
Informe u4 tema3.1.1Informe u4 tema3.1.1
Informe u4 tema3.1.1
 
Unidad 4 tema 2
Unidad 4  tema 2Unidad 4  tema 2
Unidad 4 tema 2
 
18
1818
18
 
Informe#17
Informe#17Informe#17
Informe#17
 
Formulario u4tema4
Formulario u4tema4Formulario u4tema4
Formulario u4tema4
 
In 19
In 19In 19
In 19
 
In 17
In 17In 17
In 17
 
Practica 2
Practica 2Practica 2
Practica 2
 
17 por
17 por17 por
17 por
 
In 18
In 18In 18
In 18
 
17
1717
17
 
Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)Ver y no_ver_(informe_22)
Ver y no_ver_(informe_22)
 
In 22
In 22In 22
In 22
 
23
2323
23
 
Informe#20
Informe#20Informe#20
Informe#20
 
In 20
In 20In 20
In 20
 

Más de paulcuenca9

Informe grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuencaInforme grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuencapaulcuenca9
 
Chatbot convertido compressed (1)-comprimido (3)-convertido
Chatbot convertido compressed (1)-comprimido (3)-convertidoChatbot convertido compressed (1)-comprimido (3)-convertido
Chatbot convertido compressed (1)-comprimido (3)-convertidopaulcuenca9
 
Chatbot convertido compressed (1)-comprimido (3)
Chatbot convertido compressed (1)-comprimido (3)Chatbot convertido compressed (1)-comprimido (3)
Chatbot convertido compressed (1)-comprimido (3)paulcuenca9
 
Jefferson cuenca practica_b#7
Jefferson cuenca practica_b#7Jefferson cuenca practica_b#7
Jefferson cuenca practica_b#7paulcuenca9
 
Jefferson cuenca practica_b#6
Jefferson cuenca practica_b#6Jefferson cuenca practica_b#6
Jefferson cuenca practica_b#6paulcuenca9
 
Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5paulcuenca9
 
Jefferson cuenca practica_b#4
Jefferson cuenca practica_b#4Jefferson cuenca practica_b#4
Jefferson cuenca practica_b#4paulcuenca9
 
Jefferson cuenca practica_b#3
Jefferson cuenca practica_b#3Jefferson cuenca practica_b#3
Jefferson cuenca practica_b#3paulcuenca9
 
Jefferson cuenca practica_b#2
Jefferson cuenca practica_b#2Jefferson cuenca practica_b#2
Jefferson cuenca practica_b#2paulcuenca9
 
Jefferson cuenca practica_b#1
Jefferson cuenca practica_b#1Jefferson cuenca practica_b#1
Jefferson cuenca practica_b#1paulcuenca9
 
Base de datos_-_php_myadmin_(3)
Base de datos_-_php_myadmin_(3)Base de datos_-_php_myadmin_(3)
Base de datos_-_php_myadmin_(3)paulcuenca9
 
Jefferson cuenca trabajos_individuales#13
Jefferson cuenca trabajos_individuales#13Jefferson cuenca trabajos_individuales#13
Jefferson cuenca trabajos_individuales#13paulcuenca9
 
Jefferson cuenca trabajos_individuales#12
Jefferson cuenca trabajos_individuales#12Jefferson cuenca trabajos_individuales#12
Jefferson cuenca trabajos_individuales#12paulcuenca9
 
Jefferson cuenca trabajos_individuales#11
Jefferson cuenca trabajos_individuales#11Jefferson cuenca trabajos_individuales#11
Jefferson cuenca trabajos_individuales#11paulcuenca9
 

Más de paulcuenca9 (20)

Informe grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuencaInforme grupal f_arinango_ cuenca
Informe grupal f_arinango_ cuenca
 
Chatbot convertido compressed (1)-comprimido (3)-convertido
Chatbot convertido compressed (1)-comprimido (3)-convertidoChatbot convertido compressed (1)-comprimido (3)-convertido
Chatbot convertido compressed (1)-comprimido (3)-convertido
 
Chatbot convertido compressed (1)-comprimido (3)
Chatbot convertido compressed (1)-comprimido (3)Chatbot convertido compressed (1)-comprimido (3)
Chatbot convertido compressed (1)-comprimido (3)
 
18
1818
18
 
017
017017
017
 
016
016016
016
 
Jefferson cuenca practica_b#7
Jefferson cuenca practica_b#7Jefferson cuenca practica_b#7
Jefferson cuenca practica_b#7
 
Jefferson cuenca practica_b#6
Jefferson cuenca practica_b#6Jefferson cuenca practica_b#6
Jefferson cuenca practica_b#6
 
Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5Jefferson cuenca practica_b#5
Jefferson cuenca practica_b#5
 
Jefferson cuenca practica_b#4
Jefferson cuenca practica_b#4Jefferson cuenca practica_b#4
Jefferson cuenca practica_b#4
 
Jefferson cuenca practica_b#3
Jefferson cuenca practica_b#3Jefferson cuenca practica_b#3
Jefferson cuenca practica_b#3
 
Jefferson cuenca practica_b#2
Jefferson cuenca practica_b#2Jefferson cuenca practica_b#2
Jefferson cuenca practica_b#2
 
Jefferson cuenca practica_b#1
Jefferson cuenca practica_b#1Jefferson cuenca practica_b#1
Jefferson cuenca practica_b#1
 
Base de datos_-_php_myadmin_(3)
Base de datos_-_php_myadmin_(3)Base de datos_-_php_myadmin_(3)
Base de datos_-_php_myadmin_(3)
 
Vector
VectorVector
Vector
 
15
1515
15
 
14
1414
14
 
Jefferson cuenca trabajos_individuales#13
Jefferson cuenca trabajos_individuales#13Jefferson cuenca trabajos_individuales#13
Jefferson cuenca trabajos_individuales#13
 
Jefferson cuenca trabajos_individuales#12
Jefferson cuenca trabajos_individuales#12Jefferson cuenca trabajos_individuales#12
Jefferson cuenca trabajos_individuales#12
 
Jefferson cuenca trabajos_individuales#11
Jefferson cuenca trabajos_individuales#11Jefferson cuenca trabajos_individuales#11
Jefferson cuenca trabajos_individuales#11
 

Último

Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíassuserf18419
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesFundación YOD YOD
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITMaricarmen Sánchez Ruiz
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...silviayucra2
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx241521559
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan JosephBRAYANJOSEPHPEREZGOM
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxLolaBunny11
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveFagnerLisboa3
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdfIsabellaMontaomurill
 
Herramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxHerramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxRogerPrieto3
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)GDGSucre
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIAWilbisVega
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudianteAndreaHuertas24
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricKeyla Dolores Méndez
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfsoporteupcology
 

Último (15)

Trabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnologíaTrabajo Mas Completo De Excel en clase tecnología
Trabajo Mas Completo De Excel en clase tecnología
 
KELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento ProtégelesKELA Presentacion Costa Rica 2024 - evento Protégeles
KELA Presentacion Costa Rica 2024 - evento Protégeles
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
POWER POINT YUCRAElabore una PRESENTACIÓN CORTA sobre el video película: La C...
 
Proyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptxProyecto integrador. Las TIC en la sociedad S4.pptx
Proyecto integrador. Las TIC en la sociedad S4.pptx
 
guía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Josephguía de registro de slideshare por Brayan Joseph
guía de registro de slideshare por Brayan Joseph
 
Presentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptxPresentación guía sencilla en Microsoft Excel.pptx
Presentación guía sencilla en Microsoft Excel.pptx
 
EPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial UninoveEPA-pdf resultado da prova presencial Uninove
EPA-pdf resultado da prova presencial Uninove
 
trabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdftrabajotecologiaisabella-240424003133-8f126965.pdf
trabajotecologiaisabella-240424003133-8f126965.pdf
 
Herramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptxHerramientas de corte de alta velocidad.pptx
Herramientas de corte de alta velocidad.pptx
 
International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)International Women's Day Sucre 2024 (IWD)
International Women's Day Sucre 2024 (IWD)
 
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE  DE TECNOLOGIA E INFORMATICA PRIMARIACLASE  DE TECNOLOGIA E INFORMATICA PRIMARIA
CLASE DE TECNOLOGIA E INFORMATICA PRIMARIA
 
9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante9egb-lengua y Literatura.pdf_texto del estudiante
9egb-lengua y Literatura.pdf_texto del estudiante
 
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft FabricGlobal Azure Lima 2024 - Integración de Datos con Microsoft Fabric
Global Azure Lima 2024 - Integración de Datos con Microsoft Fabric
 
Redes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdfRedes direccionamiento y subredes ipv4 2024 .pdf
Redes direccionamiento y subredes ipv4 2024 .pdf
 

Informe#25

  • 1. INFORME ESTUDIANTE: Jefferson Paul Cuenca Tenecela 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.
  • 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); voto"); 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 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. voto"); }); JOptionPane.showMessageDialog(null,"Gracias por su R3.setText(n); } btnNewButton_2.setBounds(57, 152, 119, 33); contentPane.add(btnNewButton_2); voto"); 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 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, contentPane.add(R3); 11, 10); R3.setColumns(10); R4 = new JTextField(); R4.setBounds(302, 163, contentPane.add(R4); 11, 10); 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); voto"); 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 R2.setText(n); } }); btnNewButton_1.setBounds(251, 103, 101, 38); contentPane.add(btnNewButton_1); voto"); 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 R3.setText(n); } }); btnNewButton_2.setBounds(57, 152, 119, 33);
  • 10. voto"); 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 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); } }