Beruflich Dokumente
Kultur Dokumente
APPLETS PROYECTO
los applets son pequeños programas escritos en lenguaje Java, diseñados para ser ejecutados
desde internet, que podemos colocar en nuestro servidor, junto con el resto de ficheros que
componen un sitio Web (documentos HTML, ficheros de imagen, sonido, etc.) para lograr múltiples
efectos con texto, imágenes, sonidos, etc.
El uso de applets en Java llegó a ser muy conveniente ya que el código es independiente del sistema
operativo en que se esté corriendo el navegador, sin importar si se trata de una PC con Windows,
un Mac o una computadora con alguna de las variantes de Linux. El código de un applet es ejecutado
por el navegador mismo, usando lo que se llama la máquina virtual Java (JVM, por sus siglas en
inglés: Java Virtual Machine).
Funciones especializadas, como por ejemplo, applets para calcular el valor del ángulo
inscrito en una circunferencia y circuncentro de un triángulo.
Mostrar secuencias de imágenes y agregar efectos visuales.
Mostrar imágenes con sonidos y agregar efectos sonoros.
Permitir la presentación de gráficos interactivos, reaccionando a acciones que se toman con
el mouse sobre el gráfico.
Animaciones de textos y efectos especiales sobre los mismos.
Crear diagramas y gráficas, como por ejemplo la clásica gráfica de rebanadas de pastel.
Juegos sencillos.
B. DESCRIPCIÓN:
Éste laboratorio está formado por 1 ejercicio:
C. OBJETIVO:
Conocer el funcionamiento correcto de las applets
D. PROYECTO:
Analizar el funcionamiento de las applets
E. TAREAS A REALIZAR:
Realizar los algoritmos solicitados.
F. ANÁLISIS:
ANÁLISIS DE DATOS:
class javax.swing.JApplet
class Ventana
class Guardar
ANÁLISIS DE FUNCIONES:
class javax.swing.JApplet
class Ventana
public bGuardarActionPerformed();
public bLimpiarActionPerformed();
public bSalirActionPerformed();
class Guardar
public getMarca();
public getSerie();
public getTipo();
public getMaterial();
public getConductos();
public setMarca();
public setSerie();
public setTipo();
public setMaterial();
public setConductos();
public Datos();
public ImprimirDatos();
public Limpiar();
G. DISEÑO:
DISEÑO LÓGICO:
DISEÑO FÍSICO:
H. IMPLEMENTACIÓN:
package lab51_appletsproyecto2;
import javax.swing.JOptionPane;
/*
* @author PEÑA OBACO RONNY ANTONIO
*/
public class Ventana extends javax.swing.JApplet {
/**
* Initializes the applet Ventana
*/
@Override
public void init() {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Ventana.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the applet */
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}
class Guardar{
private String marca;
private String serie;
private String tipo;
private String material;
private String conductos;
/**
* This method is called from within the init() method to initialize the
* form. WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
tMarca = new javax.swing.JTextField();
tSerie = new javax.swing.JTextField();
tTipo = new javax.swing.JTextField();
tMaterial = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
tConductos = new javax.swing.JTextField();
bGuardar = new javax.swing.JButton();
bLimpiar = new javax.swing.JButton();
bSalir = new javax.swing.JButton();
jLabel1.setText("Aire Acondicionado");
jLabel2.setText("Marca Auto");
jLabel3.setText("Serie Auto");
jLabel5.setText("Material Radiador");
tMarca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tMarcaActionPerformed(evt);
}
});
jLabel6.setText("Tipo de Conductos");
tConductos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tConductosActionPerformed(evt);
}
});
bGuardar.setText("Guardar");
bGuardar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bGuardarActionPerformed(evt);
}
});
bLimpiar.setText("limpiar");
bLimpiar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bLimpiarActionPerformed(evt);
}
});
bSalir.setText("Salir");
bSalir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bSalirActionPerformed(evt);
}
});
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tConductos))
.addGroup(layout.createSequentialGroup()
.addComponent(bGuardar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bLimpiar)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bSalir)
.addGap(0, 24, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tMaterial))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tTipo))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tSerie))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(tMarca))))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tMarca, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(tSerie, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(tTipo, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tMaterial, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(tConductos, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bGuardar)
.addComponent(bLimpiar)
.addComponent(bSalir))
.addContainerGap())
);
}// </editor-fold>
I. PRUEBAS:
J. Reporte
bLimpiarActionPerformed();
bSalirActionPerformed();
getMarca();
getSerie();
getTipo();
getMaterial();
getConductos();
setMarca();
setSerie();
setTipo();
setMaterial();
setConductos();
Datos();
ImprimirDatos();
Limpiar();
CALIFICACIÓN
K. RESULTADOS Y CONCLUSIONES:
M. REFERENCIAS BIBLIOGRÁFICAS:
[online]: http://aprenderinternet.about.com/od/Glosario/g/Applet-
Tema: En-Java.htm
Applets