applets as front ends to server side programming
play

Applets as front-ends to server-side programming DD1335 (Lecture 7) - PowerPoint PPT Presentation

Applets as front-ends Applets as front-ends to server-side programming DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18 Applets as front-ends Applets as front-ends to server-side programming Objectives DD1335 (Lecture 7)


  1. Applets as front-ends Applets as front-ends to server-side programming DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  2. Applets as front-ends Applets as front-ends to server-side programming Objectives DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  3. Applets as front-ends Applets as front-ends to server-side programming Objectives ◮ Introduce applets ◮ Examples of Java graphical programming ◮ How-to put an applet in a HTML page ◮ The HTML Applet tag and alternatives DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  4. Applets as front-ends Applets as front-ends to server-side programming Objectives ◮ Introduce applets ◮ Examples of Java graphical programming ◮ How-to put an applet in a HTML page ◮ The HTML Applet tag and alternatives ◮ Applet communication with the environment ◮ Applet-Browser (AppletContext) ◮ Applet-Applet ◮ Applet-JavaScript and JavaScript-Applet ◮ Applet-page using DOM DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  5. Applets as front-ends Applets as front-ends to server-side programming Objectives ◮ Introduce applets ◮ Examples of Java graphical programming ◮ How-to put an applet in a HTML page ◮ The HTML Applet tag and alternatives ◮ Applet communication with the environment ◮ Applet-Browser (AppletContext) ◮ Applet-Applet ◮ Applet-JavaScript and JavaScript-Applet ◮ Applet-page using DOM ◮ Applet signing DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  6. Applets as front-ends Applets as front-ends to server-side programming Objectives ◮ Introduce applets ◮ Examples of Java graphical programming ◮ How-to put an applet in a HTML page ◮ The HTML Applet tag and alternatives ◮ Applet communication with the environment ◮ Applet-Browser (AppletContext) ◮ Applet-Applet ◮ Applet-JavaScript and JavaScript-Applet ◮ Applet-page using DOM ◮ Applet signing ◮ Applet-server communication DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  7. Applets as front-ends Applets as front-ends to server-side programming Objectives ◮ Introduce applets ◮ Examples of Java graphical programming ◮ How-to put an applet in a HTML page ◮ The HTML Applet tag and alternatives ◮ Applet communication with the environment ◮ Applet-Browser (AppletContext) ◮ Applet-Applet ◮ Applet-JavaScript and JavaScript-Applet ◮ Applet-page using DOM ◮ Applet signing ◮ Applet-server communication ◮ Media in Applets and in Java DD1335 (Lecture 7) Basic Internet Programming Spring 2010 1 / 18

  8. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  9. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  10. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  11. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  12. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  13. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed ◮ Applets are written as subclasses of java.applet.Applet DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  14. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed ◮ Applets are written as subclasses of java.applet.Applet ◮ They redefine some methods to achieve desired functionality DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  15. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed ◮ Applets are written as subclasses of java.applet.Applet ◮ They redefine some methods to achieve desired functionality ◮ Since applets are downloaded before execution, large code may make the user wait quite a lot DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  16. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed ◮ Applets are written as subclasses of java.applet.Applet ◮ They redefine some methods to achieve desired functionality ◮ Since applets are downloaded before execution, large code may make the user wait quite a lot ◮ Caching in browser cache was the initial mechanism DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  17. Applets as front-ends Applets ◮ Applets are based on a Java Virtual Machine running inside a browser as a Plug-in ◮ As graphical applications, applets can give more interactive interfaces than e.g. HTML forms ◮ Since they have all the Java functionality, applets can connect to a server and communicate with it just like any Java app. ◮ However, there are security restrictions on applets downloaded from other sites than the applet’s site ◮ E.g. the local file system cannot be freely accessed ◮ Applets are written as subclasses of java.applet.Applet ◮ They redefine some methods to achieve desired functionality ◮ Since applets are downloaded before execution, large code may make the user wait quite a lot ◮ Caching in browser cache was the initial mechanism ◮ Now the Java plugin has more sophisticated caching features DD1335 (Lecture 7) Basic Internet Programming Spring 2010 2 / 18

  18. Applets as front-ends Example - java code import java.applet.*; import java.awt.*; // needed for Graphics public class FirstApplet extends Applet { // we draw a Hello. No interaction public void paint(Graphics g) { g.drawString("Hello!", 25, 50); } } DD1335 (Lecture 7) Basic Internet Programming Spring 2010 3 / 18

  19. Applets as front-ends Example - HTML code <html> <head> <title> My first applet </title> </head> <body> <applet code="FirstApplet.class" width="150" height="50" /> </body> </html> DD1335 (Lecture 7) Basic Internet Programming Spring 2010 4 / 18

  20. Applets as front-ends Applet How-To ◮ Make a subclass of java.applet.Applet and compile DD1335 (Lecture 7) Basic Internet Programming Spring 2010 5 / 18

  21. Applets as front-ends Applet How-To ◮ Make a subclass of java.applet.Applet and compile ◮ To use the latest GUI libraries, use javax.swing.JApplet DD1335 (Lecture 7) Basic Internet Programming Spring 2010 5 / 18

Recommend


More recommend