• Like
C5 applets v2
Upcoming SlideShare
Loading in...5
×
Uploaded on

 

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
950
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
18
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Applets Java y la Web Applets
  • 2. Temas
    • Las diferencias entre Applets y aplicaciones.
    • Como crear un applets
    • Como colocar un applet en una pagina Web.
    • Como enviar información de un applet a la Web.
  • 3. Objetivos
  • 4. ¿QUÉ ES UN APPLET? Un applet es una mini-aplicación, escrita en Java , que se ejecuta en un browser ( Netscape Navigator , Microsoft Internet Explorer , …) al cargar una página HTML que incluye información sobre el applet a ejecutar por medio de las tags <APPLET>... </APPLET>.
  • 5. Diferencia applets-Aplicación
  • 6. Características de los applets
  • 7. Para el programador
  • 8. Jerarquía de clases de applets
  • 9. Normas de seguridad No pueden cargar programas almacenados en el sistema del usuario El no puede ejecutar ningún programa en el sistema del lector . No pueden comunicarse con un sitio de Internet que no sea aquel que sirvió la Pág. Web que lo incluye. No pueden escribir archivos en el sistema de archivos del usuario.
  • 10. La clase Applet es la principal La clase applet que se crea asume la forma siguiente: public class yourApplet extends java.applet.Applet { //código del applet aquí }
  • 11.
        • import java.awt. Graphics ;
        • import java.awt.Font;
        • import java.awt.Color;
    • public class Palindrome extends Java.applet.Applet {
    • Font f = Font; (“TimesRoman”,Font.BOLD,36) ;
    • public void paint (Graphics screen) {
    • screen.setFont(f);
    • screen.setColor(Color.red);
    • screen.drawString(“Go hang a salami, I’m a lasagna hog.”, 5, 40);
    • }
    • }
    Ejemplo
  • 12. Un recorrido por los applets Resumen
  • 13. Applets and applications
    • An applet is a Java program that runs on a web page
      • Applets can be run within any modern browser
      • To run modern Java applets, old browsers need an up-to-date Java plugin
      • appletviewer is a program that can run
    • An application is a Java program that runs all by itself
  • 14. Packages and classes
    • Java supplies a huge library of pre-written “code,” ready for you to use in your programs
    • Code is organized into classes
    • Classes are grouped into packages
    • One way to use this code is to import it
    • You can import a single class, or all the classes in a package
  • 15. The Applet class
    • To create an applet, you must import the Applet class
      • This class is in the java.applet package
    • The Applet class contains code that works with a browser to create a display window
    • Capitalization matters!
      • applet and Applet are different names
  • 16. Importing the Applet class
    • Here is the directive that you need:
      • import java.applet.Applet;
    • import is a keyword
    • java.applet is the name of the package
    • A dot ( . ) separates the package from the class
    • Applet is the name of the class
    • There is a semicolon ( ; ) at the end
  • 17. The java.awt package
    • “ awt” stands for “Abstract Window Toolkit”
    • The java.awt package includes classes for:
      • Drawing lines and shapes
      • Drawing letters
      • Setting colors
      • Choosing fonts
    • If it’s drawn on the screen, then java.awt is probably involved!
  • 18. Ejemplo: Drawing rectangles
    • There are two ways to draw rectangles:
    • g.drawRect( left , top , width , height );
    • g.fillRect( left , top , width , height );
  • 19. Applets Hola Mundo
    • // Applet HolaMundo de ejemplo
    • //
    • import java.awt.Graphics;
    • import java.applet.Applet;
    • public class HolaMundo extends Applet { public void paint( Graphics g ) {
    • g.drawString( &quot;Hola Mundo!&quot;,25,25 ) ;
    • }
    • }