Más contenido relacionado
La actualidad más candente (20)
Más de Nefi Villaherman Medrano Barradas (14)
Pŕactica6
- 1. Ingeniería enAnimación Digital
yEfectos Visuales
Asignatura:ProgramaciónOrientadaaObjetos
Profesor:ISC.LizbethHernándezOlán
Unidad3 Herencia Fecha: 11/Mayo/2017
Practica7 Boton Página1de2
No.Control 16081898 NombredelAlumno MedranoBarradasNefiVillahermán
1. EnunciadodelProblema.
Escribaunprogramaqueescribaenlapantallasunombrecompletoyenlalíneasiguientesufechade
nacimiento.
2. CódigoFuente
/*Práctica6
No.Decontrol:16081898Nombre:MedranoBarradasNefiVillahermán
/*
//Fig.11.15:MarcoBoton.java
//CreacióndeobjetosJButton.
importjava.awt.FlowLayout;
importjava.awt.event.ActionListener;
importjava.awt.event.ActionEvent;
importjavax.swing.JFrame;
importjavax.swing.JButton;
importjavax.swing.Icon;
importjavax.swing.ImageIcon;
importjavax.swing.JOptionPane;
publicclassMarcoBotonextendsJFrame
{
privateJButtonbotonJButtonSimple;//botóncontextosolamente
privateJButtonbotonJButtonElegante;//botónconiconos
//MarcoBotonagregaobjetosJButtonaJFrame
publicMarcoBoton()
{
super("Pruebadebotones");
setLayout(newFlowLayout());//estableceelesquemadelmarco
botonJButtonSimple=newJButton("Botonsimple");//botóncontexto
add(botonJButtonSimple);//agregabotonJButtonSimpleaJFrame
Iconinsecto1=newImageIcon(getClass().getResource("ANIME05.gif"));
Iconinsecto2=newImageIcon(getClass().getResource("ANIME24.gif"));
botonJButtonElegante=newJButton("Botonelegante",insecto1);//establecelaimagen
botonJButtonElegante.setRolloverIcon(insecto2);//establecelaimagendesustitución
add(botonJButtonElegante);//agregabotonJButtonEleganteaJFrame
//creanuevoManejadorBotonparamanejarloseventosdebotón
ManejadorBotonmanejador=newManejadorBoton();
botonJButtonElegante.addActionListener(manejador);
botonJButtonSimple.addActionListener(manejador);
}//findelconstructordeMarcoBoton