SlideShare a Scribd company logo
1 of 19
IMRAN DAUD
FOUNDATION UNIVERSITY
INSTITUTE OF MANAGEMENT AND
COMPUTER SCIENCES
Imran Daud
FUIMCS
Web Engineering
Java Applets
Applets
 An applet is a Java program that a browser can
download and run.
 An applet is embedded inside a web page and runs in
the context of a browser.
 An applet must be a subclass of the
java.applet.Applet class.
 Swing provides javax.swing.JApplet.
Sample Applet Code
 Two steps to turning it in to an Applet
 1. Change "extend JFrame" to "extends JApplet" and get rid of the main, you'll have to

 import javax.swing.JApplet
 public class MyApp extends JApplet {
 ...
 } // end MyApp

 2. Embed the application into the webpage, using html

 <html>
 <head>
 <title> My Applet </title
 </head>
 <body>
 <! this is the applet tag which has attributes, there must be code, width, height>
 <applet code = "MyApp.class” width = "300” height = "300”>
 <! there can be optional parameters >
 <param name="someParamName" value="paramStringValue" >
 </applet>
 </body>
 </html>
Applet Life Cycle
 loaded -> created -> initialized -> started <=> stopped -> destroyed
 The applet maybe stopped because the user has changed focused
 JApplet has methods initialized, started, stopped and destroyed phases.
They have default behavior that you can over write.
 init() - this where you can load the parameter, someParamName, with their
String values using getParamter("someParamName"). Note that order is
not important.
 start() - here you can start things after stopping
 stop() - allows you save information before stopping and to use in start()
 destroy() - allows you clean up. Note stop will be called first.
Applets have restrictions:
 Cannot read or write files on the client machine
 Cannot run programs on the client machine
 Cannot make any computer connections
But the Applet can read data files on the Sever
Steps to create Applet Projects in
Netbeans
 Choose File > New Project (Ctrl-Shift-N). Under
Categories, select Java.
 Choose one of the following:
 If you are creating a new applet source file, select Java Class
Library under Projects. Click Next.
 If you want to import an applet source file, select Java Project
with Existing Sources. Click Next. Specify the file's location in
the Source Packages Folder text box.
 Under Project Name, type HelloApplet. Change the
Project Location to any folder on your computer.
 Click Finish.
Create applet source file
 Right-click the HelloApplet project and choose Properties
to open the Properties window.
 Select the desired Source / Binary Format for the project
from source tab.
 Right-click the HelloApplet project node in the Projects
window and select New > Other (Ctrl-N).
 Under Categories, select Java. Under File Types, select
Applet.
 (for visual design applet select Swing GUI Forms > JApplet
Form.)
 Give name to applet and click finish.
Demo
 Init()
 Start()
 Stop()
 Destroy()
Setting ground for applet
 Set all static parameters in init() function. Like
 Setsize(int width, int height)
 Setbackgroundcolor()
Applet Example
Draw Lines
Drawing Shapes
 Rectangle
 Oval
 Etc (consult documentation)
Adding Mouse
 MouseListener
 MouseMotionListener
 (Consult API Documentation for function details)
Keyboard Input
 KeyListener
 actionListener
 (Consult API Documentatio)
 Panel
 JTextField
 JTextArea
 JCombobox
 etc
Java Layouts
 FlowLayout
 BorderLayout
 GridLayout
 BoxLayout
 CardLayout
 GridBagLayout
 GroupLayout
 SpringLayout
Threads
 Thread --- Class
 Runnable ---- Interface
Class --- Thread
 Public Class A extends Thread{
 Public void run(){
 }
 }
 A aa= new A();
 aa.start();
Runnable
 Public class A implements Runnable{
 Public void run(){
 }
 }
 A aa = new A();
 Thread t1 = new Thread(aa);
 t1.start();
Reference
 http://www.csl.mtu.edu/cs2321/
 Netbeans.org

More Related Content

What's hot (20)

Java applet basics
Java applet basicsJava applet basics
Java applet basics
 
Applet progming
Applet progmingApplet progming
Applet progming
 
Applet in java
Applet in javaApplet in java
Applet in java
 
Java Applet
Java AppletJava Applet
Java Applet
 
Java applets
Java appletsJava applets
Java applets
 
Java applets
Java appletsJava applets
Java applets
 
6.applet programming in java
6.applet programming in java6.applet programming in java
6.applet programming in java
 
ITFT- Applet in java
ITFT- Applet in javaITFT- Applet in java
ITFT- Applet in java
 
first-applet
first-appletfirst-applet
first-applet
 
Java: Java Applets
Java: Java AppletsJava: Java Applets
Java: Java Applets
 
Applet programming in java
Applet programming in javaApplet programming in java
Applet programming in java
 
Java Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet ProgramsJava Programming- Introduction to Java Applet Programs
Java Programming- Introduction to Java Applet Programs
 
Java applet
Java appletJava applet
Java applet
 
Graphics programming in Java
Graphics programming in JavaGraphics programming in Java
Graphics programming in Java
 
Applet programming
Applet programming Applet programming
Applet programming
 
Java Applets
Java AppletsJava Applets
Java Applets
 
Java applets
Java appletsJava applets
Java applets
 
Applet (1)
Applet (1)Applet (1)
Applet (1)
 
Java Applets
Java AppletsJava Applets
Java Applets
 
Appl clas nd architect.56
Appl clas nd architect.56Appl clas nd architect.56
Appl clas nd architect.56
 

Viewers also liked

2. http, html
2. http, html2. http, html
2. http, htmlAnusAhmad
 
6. hibernate
6. hibernate6. hibernate
6. hibernateAnusAhmad
 
Introducing the WSO2 Governance Registry 4 1.5
Introducing the WSO2 Governance Registry 4 1.5 Introducing the WSO2 Governance Registry 4 1.5
Introducing the WSO2 Governance Registry 4 1.5 WSO2
 
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...Ricardo Cañizares Sales
 

Viewers also liked (11)

1. intro
1. intro1. intro
1. intro
 
2. http, html
2. http, html2. http, html
2. http, html
 
6. hibernate
6. hibernate6. hibernate
6. hibernate
 
4. jsp
4. jsp4. jsp
4. jsp
 
La autoestima iefap 2013
La autoestima iefap 2013La autoestima iefap 2013
La autoestima iefap 2013
 
Sistema opertaivo
Sistema opertaivoSistema opertaivo
Sistema opertaivo
 
Introducing the WSO2 Governance Registry 4 1.5
Introducing the WSO2 Governance Registry 4 1.5 Introducing the WSO2 Governance Registry 4 1.5
Introducing the WSO2 Governance Registry 4 1.5
 
Separating klout from clout
Separating klout from cloutSeparating klout from clout
Separating klout from clout
 
5. servlets
5. servlets5. servlets
5. servlets
 
Unidad 13 union europea
Unidad 13 union europeaUnidad 13 union europea
Unidad 13 union europea
 
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...
Eulen Seguridad-Ciberseguridad Industrial - Centro de Control de Seguridad In...
 

Similar to 3. applets

Similar to 3. applets (20)

Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Applet
AppletApplet
Applet
 
Java files and io streams
Java files and io streamsJava files and io streams
Java files and io streams
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
oops with java modules iii & iv.pptx
oops with java modules iii & iv.pptxoops with java modules iii & iv.pptx
oops with java modules iii & iv.pptx
 
Smart material - Unit 3 (2).pdf
Smart material - Unit 3 (2).pdfSmart material - Unit 3 (2).pdf
Smart material - Unit 3 (2).pdf
 
Smart material - Unit 3 (1).pdf
Smart material - Unit 3 (1).pdfSmart material - Unit 3 (1).pdf
Smart material - Unit 3 (1).pdf
 
Applet in java new
Applet in java newApplet in java new
Applet in java new
 
Java
JavaJava
Java
 
Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01Slide8appletv2 091028110313-phpapp01
Slide8appletv2 091028110313-phpapp01
 
applet.pptx
applet.pptxapplet.pptx
applet.pptx
 
Java applet
Java appletJava applet
Java applet
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
Class notes(week 10) on applet programming
Class notes(week 10) on applet programmingClass notes(week 10) on applet programming
Class notes(week 10) on applet programming
 
java applets
java appletsjava applets
java applets
 
Java applet
Java appletJava applet
Java applet
 
Applet
AppletApplet
Applet
 
Applets
AppletsApplets
Applets
 
Java applet programming concepts
Java  applet programming conceptsJava  applet programming concepts
Java applet programming concepts
 

More from AnusAhmad

[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexingAnusAhmad
 
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01AnusAhmad
 
[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13AnusAhmad
 
9. java server faces
9. java server faces9. java server faces
9. java server facesAnusAhmad
 
8. java script
8. java script8. java script
8. java scriptAnusAhmad
 

More from AnusAhmad (16)

[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing[Www.pkbulk.blogspot.com]file and indexing
[Www.pkbulk.blogspot.com]file and indexing
 
[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12[Www.pkbulk.blogspot.com]dbms12
[Www.pkbulk.blogspot.com]dbms12
 
[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11[Www.pkbulk.blogspot.com]dbms11
[Www.pkbulk.blogspot.com]dbms11
 
[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10[Www.pkbulk.blogspot.com]dbms10
[Www.pkbulk.blogspot.com]dbms10
 
[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09[Www.pkbulk.blogspot.com]dbms09
[Www.pkbulk.blogspot.com]dbms09
 
[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07[Www.pkbulk.blogspot.com]dbms07
[Www.pkbulk.blogspot.com]dbms07
 
[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06[Www.pkbulk.blogspot.com]dbms06
[Www.pkbulk.blogspot.com]dbms06
 
[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05[Www.pkbulk.blogspot.com]dbms05
[Www.pkbulk.blogspot.com]dbms05
 
[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04[Www.pkbulk.blogspot.com]dbms04
[Www.pkbulk.blogspot.com]dbms04
 
[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03[Www.pkbulk.blogspot.com]dbms03
[Www.pkbulk.blogspot.com]dbms03
 
[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02[Www.pkbulk.blogspot.com]dbms02
[Www.pkbulk.blogspot.com]dbms02
 
[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01[Www.pkbulk.blogspot.com]dbms01
[Www.pkbulk.blogspot.com]dbms01
 
[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13[Www.pkbulk.blogspot.com]dbms13
[Www.pkbulk.blogspot.com]dbms13
 
9. java server faces
9. java server faces9. java server faces
9. java server faces
 
8. java script
8. java script8. java script
8. java script
 
7. struts
7. struts7. struts
7. struts
 

Recently uploaded

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 

Recently uploaded (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 

3. applets

  • 1. IMRAN DAUD FOUNDATION UNIVERSITY INSTITUTE OF MANAGEMENT AND COMPUTER SCIENCES Imran Daud FUIMCS Web Engineering Java Applets
  • 2. Applets  An applet is a Java program that a browser can download and run.  An applet is embedded inside a web page and runs in the context of a browser.  An applet must be a subclass of the java.applet.Applet class.  Swing provides javax.swing.JApplet.
  • 3. Sample Applet Code  Two steps to turning it in to an Applet  1. Change "extend JFrame" to "extends JApplet" and get rid of the main, you'll have to   import javax.swing.JApplet  public class MyApp extends JApplet {  ...  } // end MyApp   2. Embed the application into the webpage, using html   <html>  <head>  <title> My Applet </title  </head>  <body>  <! this is the applet tag which has attributes, there must be code, width, height>  <applet code = "MyApp.class” width = "300” height = "300”>  <! there can be optional parameters >  <param name="someParamName" value="paramStringValue" >  </applet>  </body>  </html>
  • 4. Applet Life Cycle  loaded -> created -> initialized -> started <=> stopped -> destroyed  The applet maybe stopped because the user has changed focused  JApplet has methods initialized, started, stopped and destroyed phases. They have default behavior that you can over write.  init() - this where you can load the parameter, someParamName, with their String values using getParamter("someParamName"). Note that order is not important.  start() - here you can start things after stopping  stop() - allows you save information before stopping and to use in start()  destroy() - allows you clean up. Note stop will be called first.
  • 5. Applets have restrictions:  Cannot read or write files on the client machine  Cannot run programs on the client machine  Cannot make any computer connections But the Applet can read data files on the Sever
  • 6. Steps to create Applet Projects in Netbeans  Choose File > New Project (Ctrl-Shift-N). Under Categories, select Java.  Choose one of the following:  If you are creating a new applet source file, select Java Class Library under Projects. Click Next.  If you want to import an applet source file, select Java Project with Existing Sources. Click Next. Specify the file's location in the Source Packages Folder text box.  Under Project Name, type HelloApplet. Change the Project Location to any folder on your computer.  Click Finish.
  • 7. Create applet source file  Right-click the HelloApplet project and choose Properties to open the Properties window.  Select the desired Source / Binary Format for the project from source tab.  Right-click the HelloApplet project node in the Projects window and select New > Other (Ctrl-N).  Under Categories, select Java. Under File Types, select Applet.  (for visual design applet select Swing GUI Forms > JApplet Form.)  Give name to applet and click finish.
  • 8. Demo  Init()  Start()  Stop()  Destroy()
  • 9. Setting ground for applet  Set all static parameters in init() function. Like  Setsize(int width, int height)  Setbackgroundcolor()
  • 11. Drawing Shapes  Rectangle  Oval  Etc (consult documentation)
  • 12. Adding Mouse  MouseListener  MouseMotionListener  (Consult API Documentation for function details)
  • 13. Keyboard Input  KeyListener  actionListener  (Consult API Documentatio)
  • 14.  Panel  JTextField  JTextArea  JCombobox  etc
  • 15. Java Layouts  FlowLayout  BorderLayout  GridLayout  BoxLayout  CardLayout  GridBagLayout  GroupLayout  SpringLayout
  • 16. Threads  Thread --- Class  Runnable ---- Interface
  • 17. Class --- Thread  Public Class A extends Thread{  Public void run(){  }  }  A aa= new A();  aa.start();
  • 18. Runnable  Public class A implements Runnable{  Public void run(){  }  }  A aa = new A();  Thread t1 = new Thread(aa);  t1.start();