SlideShare una empresa de Scribd logo
1 de 7
Descargar para leer sin conexión
INFORME
ESTUDIANETE: JUAN PABLO SIMBAÑA. SEMESTRE: SEGUNDO
PARALELO: C PRÁCTICA:18
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
ACTIVIDADES:
-Realizar un programa en el que ingrese 3 botones, uno que me cambie de color
el fondo del formulario, otro que cambie las palabras y otro para salir.
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. Pondremos 1 label que diga Universidad Central del Ecuador, y 4 botones, uno que
diga cambiar color, otro que diga cambiar tipo de letra, otro de regresar y otro de salir
10. En el botón de cambiar de color ingresaremos el siguiente código, el cual nos va a
permitir cambiar de color el fondo.
JButton btnNewButton = new JButton("CAMBIAR DE COLOR");
btnNewButton.setBounds(62, 135, 306, 23);
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
contentPane.setBackground(Color.BLUE);
11. En el botón de cambiar tipo de letra ingresaremos el siguiente código, el cual nos
va a permitir cambiar de color el fondo.
JButton btnNewButton_1 = new JButton("CAMBIAR TIPO DE LETRA");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
lblNewLabel.setText("FILOSOFÍA");
}
12. En el botón de salir ingresaremos el siguiente código, el cual nos va a permitir
Salir del formulario.
JButton btnNewButton_1 = new JButton("SALIR");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(WIDTH);
}
13. En el botón de regresar ingresaremos el siguiente código, el cual nos va a permitir
Salir del formulario.
JButton btnNewButton_3 = new JButton("REGRESAR");
btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Form4 verForm4=new Form4 ();
verForm4.setVisible(true);
Form2.this.dispose();
12. Por último utilizaremos el botón para correr el programa.
13.- Si damos clic en cambiar de color nos aparecerá el color celeste
14.- Si le damos click en cambiar tipo de letra nos cambiara a FILOSOFIA
14.- Si le damos click en SALIR se saldrá del programa
11.- Por último, dejaré la línea de código que utilicé. En el proyecto operación
utilicé el siguiente código:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Form2 extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Form2 frame = new Form2();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public Form2() {
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("UNIVERSIDAD CENTRAL DEL
ECUADOR ");
lblNewLabel.setBounds(124, 89, 244, 44);
contentPane.add(lblNewLabel);
JButton btnNewButton = new JButton("CAMBIAR DE COLOR ");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
contentPane.setBackground(Color .CYAN);
}
});
btnNewButton.setBounds(126, 133, 197, 23);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("CAMBIAR TIPO DE LETRA");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
lblNewLabel.setText("FILOSOFÍA");
}
});
btnNewButton_1.setBounds(124, 167, 197, 23);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("SALIR");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
btnNewButton_2.setBounds(182, 238, 89, 23);
contentPane.add(btnNewButton_2);
JButton btnNewButton_3 = new JButton("REGRESAR");
btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
Form4 verForm4=new Form4 ();
verForm4.setVisible(true);
Form2.this.dispose();
}
});
btnNewButton_3.setBounds(182, 204, 89, 23);
contentPane.add(btnNewButton_3);
}
}

Más contenido relacionado

La actualidad más candente (20)

In 22
In 22In 22
In 22
 
Formulario u4tema4
Formulario u4tema4Formulario u4tema4
Formulario u4tema4
 
Informe#17
Informe#17Informe#17
Informe#17
 
Informe 4 de formularios
Informe 4 de formulariosInforme 4 de formularios
Informe 4 de formularios
 
In 17
In 17In 17
In 17
 
In 18
In 18In 18
In 18
 
In 19
In 19In 19
In 19
 
09
0909
09
 
Informe votaciones
Informe votacionesInforme votaciones
Informe votaciones
 
20 por
20 por20 por
20 por
 
09 porta
09 porta09 porta
09 porta
 
21 porta
21 porta21 porta
21 porta
 
Informe#21
Informe#21Informe#21
Informe#21
 
20
2020
20
 
21
2121
21
 
Unidad 4 tema 4 - 3
Unidad 4 tema 4 - 3Unidad 4 tema 4 - 3
Unidad 4 tema 4 - 3
 
Informe u4tema3
Informe u4tema3Informe u4tema3
Informe u4tema3
 
In 20
In 20In 20
In 20
 
Informe#20
Informe#20Informe#20
Informe#20
 
In 11
In 11In 11
In 11
 

Similar a 18 por (17)

Informe#19
Informe#19Informe#19
Informe#19
 
Practica 11
Practica 11Practica 11
Practica 11
 
Practica 10
Practica 10Practica 10
Practica 10
 
Informe#9
Informe#9Informe#9
Informe#9
 
Unid 4 tema 4
Unid 4  tema 4Unid 4  tema 4
Unid 4 tema 4
 
10
1010
10
 
23
2323
23
 
10 porta
10 porta10 porta
10 porta
 
Informe#13
Informe#13Informe#13
Informe#13
 
Informe#10
Informe#10Informe#10
Informe#10
 
13
1313
13
 
13
1313
13
 
Practica 13
Practica 13Practica 13
Practica 13
 
Informe#12
Informe#12Informe#12
Informe#12
 
Informe u4tema3.2
Informe u4tema3.2Informe u4tema3.2
Informe u4tema3.2
 
13 porta
13 porta13 porta
13 porta
 
12
1212
12
 

Más de JuanSimbaa8 (20)

30
3030
30
 
29
2929
29
 
28
2828
28
 
27
2727
27
 
26
2626
26
 
25
2525
25
 
24
2424
24
 
23
2323
23
 
22
2222
22
 
21
2121
21
 
20
2020
20
 
19
1919
19
 
Final portafolio 3 c (1)
Final portafolio 3 c (1)Final portafolio 3 c (1)
Final portafolio 3 c (1)
 
18
1818
18
 
17
1717
17
 
16
1616
16
 
15
1515
15
 
14
1414
14
 
13
1313
13
 
12
1212
12
 

Último

ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN PARÍS. Por JAVIER SOL...
ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN  PARÍS. Por JAVIER SOL...ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN  PARÍS. Por JAVIER SOL...
ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN PARÍS. Por JAVIER SOL...JAVIER SOLIS NOYOLA
 
PLAN LECTOR 2024 integrado nivel inicial-miercoles 10.pptx
PLAN LECTOR 2024  integrado nivel inicial-miercoles 10.pptxPLAN LECTOR 2024  integrado nivel inicial-miercoles 10.pptx
PLAN LECTOR 2024 integrado nivel inicial-miercoles 10.pptxCamuchaCrdovaAlonso
 
Tema 10. Dinámica y funciones de la Atmosfera 2024
Tema 10. Dinámica y funciones de la Atmosfera 2024Tema 10. Dinámica y funciones de la Atmosfera 2024
Tema 10. Dinámica y funciones de la Atmosfera 2024IES Vicent Andres Estelles
 
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docx
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docxUNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docx
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docxMaria Jimena Leon Malharro
 
AEC 2. Aventura en el Antiguo Egipto.pptx
AEC 2. Aventura en el Antiguo Egipto.pptxAEC 2. Aventura en el Antiguo Egipto.pptx
AEC 2. Aventura en el Antiguo Egipto.pptxhenarfdez
 
Concepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxConcepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxFernando Solis
 
La Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalLa Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalJonathanCovena1
 
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxCONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxroberthirigoinvasque
 
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfFeliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfMercedes Gonzalez
 
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAJAVIER SOLIS NOYOLA
 
La Evaluacion Formativa SM6 Ccesa007.pdf
La Evaluacion Formativa SM6  Ccesa007.pdfLa Evaluacion Formativa SM6  Ccesa007.pdf
La Evaluacion Formativa SM6 Ccesa007.pdfDemetrio Ccesa Rayme
 
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...rosalindatellodelagu
 
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdf
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdfPlan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdf
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdfcarolinamartinezsev
 
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...Procedimientos para la planificación en los Centros Educativos tipo V ( multi...
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...Katherine Concepcion Gonzalez
 
Factores que intervienen en la Administración por Valores.pdf
Factores que intervienen en la Administración por Valores.pdfFactores que intervienen en la Administración por Valores.pdf
Factores que intervienen en la Administración por Valores.pdfJonathanCovena1
 
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptx
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptxAEC2. Egipto Antiguo. Adivina, Adivinanza.pptx
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptxhenarfdez
 
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docxEliaHernndez7
 

Último (20)

ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN PARÍS. Por JAVIER SOL...
ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN  PARÍS. Por JAVIER SOL...ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN  PARÍS. Por JAVIER SOL...
ACERTIJO LA RUTA DEL MARATÓN OLÍMPICO DEL NÚMERO PI EN PARÍS. Por JAVIER SOL...
 
PLAN LECTOR 2024 integrado nivel inicial-miercoles 10.pptx
PLAN LECTOR 2024  integrado nivel inicial-miercoles 10.pptxPLAN LECTOR 2024  integrado nivel inicial-miercoles 10.pptx
PLAN LECTOR 2024 integrado nivel inicial-miercoles 10.pptx
 
Tema 10. Dinámica y funciones de la Atmosfera 2024
Tema 10. Dinámica y funciones de la Atmosfera 2024Tema 10. Dinámica y funciones de la Atmosfera 2024
Tema 10. Dinámica y funciones de la Atmosfera 2024
 
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docx
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docxUNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docx
UNIDAD DIDACTICA nivel inicial EL SUPERMERCADO.docx
 
AEC 2. Aventura en el Antiguo Egipto.pptx
AEC 2. Aventura en el Antiguo Egipto.pptxAEC 2. Aventura en el Antiguo Egipto.pptx
AEC 2. Aventura en el Antiguo Egipto.pptx
 
Concepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptxConcepto y definición de tipos de Datos Abstractos en c++.pptx
Concepto y definición de tipos de Datos Abstractos en c++.pptx
 
La Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración AmbientalLa Sostenibilidad Corporativa. Administración Ambiental
La Sostenibilidad Corporativa. Administración Ambiental
 
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptxCONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
CONCURSO NACIONAL JOSE MARIA ARGUEDAS.pptx
 
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdfFeliz Día de la Madre - 5 de Mayo, 2024.pdf
Feliz Día de la Madre - 5 de Mayo, 2024.pdf
 
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLAACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
ACRÓNIMO DE PARÍS PARA SU OLIMPIADA 2024. Por JAVIER SOLIS NOYOLA
 
La Evaluacion Formativa SM6 Ccesa007.pdf
La Evaluacion Formativa SM6  Ccesa007.pdfLa Evaluacion Formativa SM6  Ccesa007.pdf
La Evaluacion Formativa SM6 Ccesa007.pdf
 
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...
UNIDAD DE APRENDIZAJE DE PRIMER GRADO DEL MES DE MAYO PARA TRABAJAR CON ESTUD...
 
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdf
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdfPlan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdf
Plan-de-la-Patria-2019-2025- TERCER PLAN SOCIALISTA DE LA NACIÓN.pdf
 
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...Procedimientos para la planificación en los Centros Educativos tipo V ( multi...
Procedimientos para la planificación en los Centros Educativos tipo V ( multi...
 
Sesión de clase APC: Los dos testigos.pdf
Sesión de clase APC: Los dos testigos.pdfSesión de clase APC: Los dos testigos.pdf
Sesión de clase APC: Los dos testigos.pdf
 
Factores que intervienen en la Administración por Valores.pdf
Factores que intervienen en la Administración por Valores.pdfFactores que intervienen en la Administración por Valores.pdf
Factores que intervienen en la Administración por Valores.pdf
 
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptx
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptxAEC2. Egipto Antiguo. Adivina, Adivinanza.pptx
AEC2. Egipto Antiguo. Adivina, Adivinanza.pptx
 
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx
🦄💫4° SEM32 WORD PLANEACIÓN PROYECTOS DARUKEL 23-24.docx
 
Power Point E. S.: Los dos testigos.pptx
Power Point E. S.: Los dos testigos.pptxPower Point E. S.: Los dos testigos.pptx
Power Point E. S.: Los dos testigos.pptx
 
PP_Comunicacion en Salud: Objetivación de signos y síntomas
PP_Comunicacion en Salud: Objetivación de signos y síntomasPP_Comunicacion en Salud: Objetivación de signos y síntomas
PP_Comunicacion en Salud: Objetivación de signos y síntomas
 

18 por

  • 1. INFORME ESTUDIANETE: JUAN PABLO SIMBAÑA. SEMESTRE: SEGUNDO PARALELO: C PRÁCTICA:18 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 ACTIVIDADES: -Realizar un programa en el que ingrese 3 botones, uno que me cambie de color el fondo del formulario, otro que cambie las palabras y otro para salir. 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. Pondremos 1 label que diga Universidad Central del Ecuador, y 4 botones, uno que diga cambiar color, otro que diga cambiar tipo de letra, otro de regresar y otro de salir 10. En el botón de cambiar de color ingresaremos el siguiente código, el cual nos va a permitir cambiar de color el fondo. JButton btnNewButton = new JButton("CAMBIAR DE COLOR"); btnNewButton.setBounds(62, 135, 306, 23); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { contentPane.setBackground(Color.BLUE); 11. En el botón de cambiar tipo de letra ingresaremos el siguiente código, el cual nos va a permitir cambiar de color el fondo. JButton btnNewButton_1 = new JButton("CAMBIAR TIPO DE LETRA"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { lblNewLabel.setText("FILOSOFÍA"); } 12. En el botón de salir ingresaremos el siguiente código, el cual nos va a permitir Salir del formulario. JButton btnNewButton_1 = new JButton("SALIR"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(WIDTH); }
  • 5. 13. En el botón de regresar ingresaremos el siguiente código, el cual nos va a permitir Salir del formulario. JButton btnNewButton_3 = new JButton("REGRESAR"); btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Form4 verForm4=new Form4 (); verForm4.setVisible(true); Form2.this.dispose(); 12. Por último utilizaremos el botón para correr el programa. 13.- Si damos clic en cambiar de color nos aparecerá el color celeste 14.- Si le damos click en cambiar tipo de letra nos cambiara a FILOSOFIA 14.- Si le damos click en SALIR se saldrá del programa
  • 6. 11.- Por último, dejaré la línea de código que utilicé. En el proyecto operación utilicé el siguiente código: import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Form2 extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Form2 frame = new Form2(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public Form2() { 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("UNIVERSIDAD CENTRAL DEL ECUADOR "); lblNewLabel.setBounds(124, 89, 244, 44); contentPane.add(lblNewLabel); JButton btnNewButton = new JButton("CAMBIAR DE COLOR "); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { contentPane.setBackground(Color .CYAN); } }); btnNewButton.setBounds(126, 133, 197, 23); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("CAMBIAR TIPO DE LETRA"); btnNewButton_1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { lblNewLabel.setText("FILOSOFÍA");
  • 7. } }); btnNewButton_1.setBounds(124, 167, 197, 23); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("SALIR"); btnNewButton_2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { System.exit(0); } }); btnNewButton_2.setBounds(182, 238, 89, 23); contentPane.add(btnNewButton_2); JButton btnNewButton_3 = new JButton("REGRESAR"); btnNewButton_3.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Form4 verForm4=new Form4 (); verForm4.setVisible(true); Form2.this.dispose(); } }); btnNewButton_3.setBounds(182, 204, 89, 23); contentPane.add(btnNewButton_3); } }