SlideShare a Scribd company logo
1 of 3
Java Applet Handouts
    1. To create an applet from BlueJ, simply click new class then the applet radio button.
            • Note that the classes automatically imported are:
                • import java.awt.*;
                • import javax.swing.*;
    2. All applets generated will extend the JApplet class thus having to implement the ff methods:
            • public void init() { }
            • public void start() { }
            • public void stop() { }
            • public void paint(Graphics g) { }
            • public void destroy(){ }
Methods will run in sequence displayed.
To customize the look of the applet, call Graphics methods in the paint method.
      abstract void copyArea(int x, int y, int width, int height, int dx, int dy)
                            Copies an area of the component by a distance specified by dx and dy.
               void draw3DRect(int x, int y, int width, int height, boolean raised)
                            Draws a 3-D highlighted outline of the specified rectangle.
      abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
                            Draws the outline of a circular or elliptical arc covering the specified rectangle.
               void drawBytes(byte[] data, int offset, int length, int x, int y)
                           Draws the text given by the specified byte array, using this graphics context's current font and
                     color.
               void drawChars(char[] data, int offset, int length, int x, int y)
                          Draws the text given by the specified character array, using this graphics context's current font
                     and color.
  abstract boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer)
                            Draws as much of the specified image as is currently available.
  abstract boolean drawImage(Image img, int x, int y, ImageObserver observer)
                            Draws as much of the specified image as is currently available.
  abstract boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer)
                          Draws as much of the specified image as has already been scaled to fit inside the specified
                     rectangle.
  abstract boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
                          Draws as much of the specified image as has already been scaled to fit inside the specified
                     rectangle.
  abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor,
                   ImageObserver observer)
                           Draws as much of the specified area of the specified image as is currently available, scaling it on
                     the fly to fit inside the specified area of the destination drawable surface.
  abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
                   ImageObserver observer)
                           Draws as much of the specified area of the specified image as is currently available, scaling it on
                     the fly to fit inside the specified area of the destination drawable surface.
      abstract void drawLine(int x1, int y1, int x2, int y2)
                          Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics
                     context's coordinate system.
abstract void drawOval(int x, int y, int width, int height)
                       Draws the outline of an oval.
 abstract void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
                       Draws a closed polygon defined by arrays of x and y coordinates.
           void drawPolygon(Polygon p)
                       Draws the outline of a polygon defined by the specified Polygon object.
 abstract void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
                       Draws a sequence of connected lines defined by arrays of x and y coordinates.
           void drawRect(int x, int y, int width, int height)
                       Draws the outline of the specified rectangle.
 abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
                       Draws an outlined round-cornered rectangle using this graphics context's current color.
 abstract void drawString(AttributedCharacterIterator iterator, int x, int y)
                       Draws the text given by the specified iterator, using this graphics context's current color.
 abstract void drawString(String str, int x, int y)
                       Draws the text given by the specified string, using this graphics context's current font and color.
           void fill3DRect(int x, int y, int width, int height, boolean raised)
                       Paints a 3-D highlighted rectangle filled with the current color.


 abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
                       Fills a circular or elliptical arc covering the specified rectangle.
 abstract void fillOval(int x, int y, int width, int height)
                       Fills an oval bounded by the specified rectangle with the current color.
 abstract void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
                       Fills a closed polygon defined by arrays of x and y coordinates.
           void fillPolygon(Polygon p)
                       Fills the polygon defined by the specified Polygon object with the graphics context's current
                 color.
 abstract void fillRect(int x, int y, int width, int height)
                       Fills the specified rectangle.
 abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
                       Fills the specified rounded corner rectangle with the current color.
abstract Color getColor()
                       Gets this graphics context's current color.
abstract Font getFont()
                       Gets the current font.
 abstract void setColor(Color c)
                       Sets this graphics context's current color to the specified color.
 abstract void setFont(Font font)
                       Sets this graphics context's font to the specified font.
How to add Mouse Events
   1. Import necessary classes:
          a. import java.applet.*;
          b. import java.awt.*;
          c. import java.awt.event.*;
          d. import javax.swing.*;
   2. Add interfaces
          a. MouseListener
          b. MouseMotionListener
   3. Implements necessary methods
       • public void mouseEntered( MouseEvent e ) {
              // called when the pointer enters the applet's rectangular area
          }
       • public void mouseExited( MouseEvent e ) {
              // called when the pointer leaves the applet's rectangular area
          }
       • public void mouseClicked( MouseEvent e ) {
              // called after a press and release of a mouse button
              // with no motion in between
              // (If the user presses, drags, and then releases, there will be
              // no click event generated.)
          }
       • public void mousePressed( MouseEvent e ) {
              // called after a button is pressed down
          }
       • public void mouseReleased( MouseEvent e ) {
              // called after a button is released
          }
       • public void mouseMoved( MouseEvent e ) {
              // called during motion when no buttons are down
          }
       • public void mouseDragged( MouseEvent e ) {
              // called during motion with buttons down
          }

   4. Add the interface in the init function
         a. addMouseListener( this );
         b. addMouseMotionListener( this );
   5. Additional MouseEvent Methods
         a. Int getClickCount()
                    Return the number of mouse clicks associated with this event.
         b. Int getX()
                    Returns the horizontal x position of the event relative to the source component.
         c. Int getY()
                    Returns the vertical y position of the event relative to the source component.

More Related Content

What's hot

Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics TutorialCheng-An Yang
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]Saajid Akram
 
Java Graphics
Java GraphicsJava Graphics
Java GraphicsShraddha
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphicsRafi_Dar
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingMark Kilgard
 
Geometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping SetupGeometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping SetupMark Kilgard
 
Matlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge DetectionMatlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge DetectionDataminingTools Inc
 
Swift, via "swift-2048"
Swift, via "swift-2048"Swift, via "swift-2048"
Swift, via "swift-2048"Austin Zheng
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1?? ?
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityWithTheBest
 
Project2
Project2Project2
Project2?? ?
 
Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Saajid Akram
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VIMax Kleiner
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeVinayak Sahai
 

What's hot (20)

JavaYDL13
JavaYDL13JavaYDL13
JavaYDL13
 
Matlab Graphics Tutorial
Matlab Graphics TutorialMatlab Graphics Tutorial
Matlab Graphics Tutorial
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]Class[5][9th jul] [three js-meshes_geometries_and_primitives]
Class[5][9th jul] [three js-meshes_geometries_and_primitives]
 
Java Graphics
Java GraphicsJava Graphics
Java Graphics
 
Dip3
Dip3Dip3
Dip3
 
java graphics
java graphicsjava graphics
java graphics
 
Lecture on graphics
Lecture on graphicsLecture on graphics
Lecture on graphics
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Geometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping SetupGeometry Shader-based Bump Mapping Setup
Geometry Shader-based Bump Mapping Setup
 
Matlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge DetectionMatlab Feature Extraction Using Segmentation And Edge Detection
Matlab Feature Extraction Using Segmentation And Edge Detection
 
Swift, via "swift-2048"
Swift, via "swift-2048"Swift, via "swift-2048"
Swift, via "swift-2048"
 
ECE 565 Project1
ECE 565 Project1ECE 565 Project1
ECE 565 Project1
 
Test
TestTest
Test
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unity
 
Project2
Project2Project2
Project2
 
Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]
 
maXbox starter68 machine learning VI
maXbox starter68 machine learning VImaXbox starter68 machine learning VI
maXbox starter68 machine learning VI
 
Introductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT RoorkeeIntroductory Digital Image Processing using Matlab, IIT Roorkee
Introductory Digital Image Processing using Matlab, IIT Roorkee
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 

Viewers also liked

Yearbook grad pic orders
Yearbook   grad pic ordersYearbook   grad pic orders
Yearbook grad pic ordersiamkim
 
Reminders
RemindersReminders
Remindersiamkim
 
Health evaluation of life threatening conditions
Health   evaluation of life threatening conditionsHealth   evaluation of life threatening conditions
Health evaluation of life threatening conditionsiamkim
 
Ss northern renaissance
Ss   northern renaissanceSs   northern renaissance
Ss northern renaissanceiamkim
 
Yearbook grad pic orders
Yearbook   grad pic ordersYearbook   grad pic orders
Yearbook grad pic ordersiamkim
 
Chi square hand out
Chi square hand outChi square hand out
Chi square hand outiamkim
 
Econ syllabus, ex log, infocard
Econ   syllabus, ex log, infocardEcon   syllabus, ex log, infocard
Econ syllabus, ex log, infocardiamkim
 
Cat room assignments for lakbay-aral (v1).
Cat   room assignments for lakbay-aral (v1).Cat   room assignments for lakbay-aral (v1).
Cat room assignments for lakbay-aral (v1).iamkim
 
Pax romana2
Pax romana2Pax romana2
Pax romana2iamkim
 
Ss greek civilization
Ss   greek civilizationSs   greek civilization
Ss greek civilizationiamkim
 
Family day 2010 newsletter final
Family day 2010 newsletter   finalFamily day 2010 newsletter   final
Family day 2010 newsletter finaliamkim
 
Physics statics
Physics   staticsPhysics   statics
Physics staticsiamkim
 
Str statistics lec notes
Str   statistics lec notesStr   statistics lec notes
Str statistics lec notesiamkim
 
14 january 2011 congress
14 january 2011 congress14 january 2011 congress
14 january 2011 congressiamkim
 
Chi square hand out (1)
Chi square hand out (1)Chi square hand out (1)
Chi square hand out (1)iamkim
 
Fil panitikan
Fil   panitikanFil   panitikan
Fil panitikaniamkim
 
Str tlc
Str   tlcStr   tlc
Str tlciamkim
 
Nat Sci - Minerals
Nat Sci - MineralsNat Sci - Minerals
Nat Sci - Mineralsiamkim
 
3F test / Introduction
3F test / Introduction3F test / Introduction
3F test / Introductionvit_r
 
Porter Marcompresentation
Porter MarcompresentationPorter Marcompresentation
Porter MarcompresentationAndrew J Porter
 

Viewers also liked (20)

Yearbook grad pic orders
Yearbook   grad pic ordersYearbook   grad pic orders
Yearbook grad pic orders
 
Reminders
RemindersReminders
Reminders
 
Health evaluation of life threatening conditions
Health   evaluation of life threatening conditionsHealth   evaluation of life threatening conditions
Health evaluation of life threatening conditions
 
Ss northern renaissance
Ss   northern renaissanceSs   northern renaissance
Ss northern renaissance
 
Yearbook grad pic orders
Yearbook   grad pic ordersYearbook   grad pic orders
Yearbook grad pic orders
 
Chi square hand out
Chi square hand outChi square hand out
Chi square hand out
 
Econ syllabus, ex log, infocard
Econ   syllabus, ex log, infocardEcon   syllabus, ex log, infocard
Econ syllabus, ex log, infocard
 
Cat room assignments for lakbay-aral (v1).
Cat   room assignments for lakbay-aral (v1).Cat   room assignments for lakbay-aral (v1).
Cat room assignments for lakbay-aral (v1).
 
Pax romana2
Pax romana2Pax romana2
Pax romana2
 
Ss greek civilization
Ss   greek civilizationSs   greek civilization
Ss greek civilization
 
Family day 2010 newsletter final
Family day 2010 newsletter   finalFamily day 2010 newsletter   final
Family day 2010 newsletter final
 
Physics statics
Physics   staticsPhysics   statics
Physics statics
 
Str statistics lec notes
Str   statistics lec notesStr   statistics lec notes
Str statistics lec notes
 
14 january 2011 congress
14 january 2011 congress14 january 2011 congress
14 january 2011 congress
 
Chi square hand out (1)
Chi square hand out (1)Chi square hand out (1)
Chi square hand out (1)
 
Fil panitikan
Fil   panitikanFil   panitikan
Fil panitikan
 
Str tlc
Str   tlcStr   tlc
Str tlc
 
Nat Sci - Minerals
Nat Sci - MineralsNat Sci - Minerals
Nat Sci - Minerals
 
3F test / Introduction
3F test / Introduction3F test / Introduction
3F test / Introduction
 
Porter Marcompresentation
Porter MarcompresentationPorter Marcompresentation
Porter Marcompresentation
 

Similar to Java applet handouts

C++ Windows Forms L08 - GDI P1
C++ Windows Forms L08 - GDI P1 C++ Windows Forms L08 - GDI P1
C++ Windows Forms L08 - GDI P1 Mohammad Shaker
 
U5 JAVA.pptx
U5 JAVA.pptxU5 JAVA.pptx
U5 JAVA.pptxmadan r
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxdunhamadell
 
OOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptxOOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptxTanzila Kehkashan
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docxmercysuttle
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxfredharris32
 
MIDP: Form Custom and Image Items
MIDP: Form Custom and Image ItemsMIDP: Form Custom and Image Items
MIDP: Form Custom and Image ItemsJussi Pohjolainen
 
Explanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expertExplanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expert홍배 김
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingFayan TAO
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABSriram Emarose
 
graphics programming in java
graphics programming in javagraphics programming in java
graphics programming in javaAbinaya B
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 

Similar to Java applet handouts (20)

C++ Windows Forms L08 - GDI P1
C++ Windows Forms L08 - GDI P1 C++ Windows Forms L08 - GDI P1
C++ Windows Forms L08 - GDI P1
 
U5 JAVA.pptx
U5 JAVA.pptxU5 JAVA.pptx
U5 JAVA.pptx
 
On the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docxOn the tomcat drive in folder cosc210 you will find file named Paint.docx
On the tomcat drive in folder cosc210 you will find file named Paint.docx
 
Java swing
Java swingJava swing
Java swing
 
OOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptxOOP Lecture 21-Graphics, Audio.pptx
OOP Lecture 21-Graphics, Audio.pptx
 
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx1 of 6  LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
1 of 6 LAB 5 IMAGE FILTERING ECE180 Introduction to.docx
 
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docxasmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
asmt7~$sc_210_-_assignment_7_fall_15.docasmt7cosc_210_-_as.docx
 
MIDP: Form Custom and Image Items
MIDP: Form Custom and Image ItemsMIDP: Form Custom and Image Items
MIDP: Form Custom and Image Items
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
OpenVX 1.3 Reference Guide
OpenVX 1.3 Reference GuideOpenVX 1.3 Reference Guide
OpenVX 1.3 Reference Guide
 
canvas_1.pptx
canvas_1.pptxcanvas_1.pptx
canvas_1.pptx
 
Applet in java
Applet in javaApplet in java
Applet in java
 
Explanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expertExplanation on Tensorflow example -Deep mnist for expert
Explanation on Tensorflow example -Deep mnist for expert
 
13slide graphics
13slide graphics13slide graphics
13slide graphics
 
TAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume renderingTAO Fayan_X-Ray and MIP volume rendering
TAO Fayan_X-Ray and MIP volume rendering
 
Introduction to Image Processing with MATLAB
Introduction to Image Processing with MATLABIntroduction to Image Processing with MATLAB
Introduction to Image Processing with MATLAB
 
graphics programming in java
graphics programming in javagraphics programming in java
graphics programming in java
 
OpenVX 1.0 Reference Guide
OpenVX 1.0 Reference GuideOpenVX 1.0 Reference Guide
OpenVX 1.0 Reference Guide
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 

More from iamkim

Nat sci minerals part1
Nat sci   minerals part1Nat sci   minerals part1
Nat sci minerals part1iamkim
 
Batch 2012 schedule of exit interview
Batch 2012 schedule of exit interviewBatch 2012 schedule of exit interview
Batch 2012 schedule of exit interviewiamkim
 
College test results b2012
College test results b2012College test results b2012
College test results b2012iamkim
 
Chem cations
Chem   cationsChem   cations
Chem cationsiamkim
 
Chem anions
Chem   anionsChem   anions
Chem anionsiamkim
 
Grad ball collections per section(01 28-12)
Grad ball collections per section(01 28-12)Grad ball collections per section(01 28-12)
Grad ball collections per section(01 28-12)iamkim
 
Congratulations to batch 2012 star scholar candidates
Congratulations to batch 2012 star scholar candidatesCongratulations to batch 2012 star scholar candidates
Congratulations to batch 2012 star scholar candidatesiamkim
 
Retreat consent form
Retreat consent formRetreat consent form
Retreat consent formiamkim
 
Retreat agreements
Retreat agreementsRetreat agreements
Retreat agreementsiamkim
 
Fil la loba negra
Fil   la loba negraFil   la loba negra
Fil la loba negraiamkim
 
Fil fray botod
Fil   fray botodFil   fray botod
Fil fray botodiamkim
 
Fil 3 q readings
Fil   3 q readingsFil   3 q readings
Fil 3 q readingsiamkim
 
Dasalan at tocsohan
Dasalan at tocsohanDasalan at tocsohan
Dasalan at tocsohaniamkim
 
Chem ps electrolysis
Chem   ps electrolysisChem   ps electrolysis
Chem ps electrolysisiamkim
 
Physics waves
Physics   wavesPhysics   waves
Physics wavesiamkim
 
Math 3 hw ps2
Math   3 hw ps2Math   3 hw ps2
Math 3 hw ps2iamkim
 
Memo circular # 4 dtd nov 4, 2011
Memo circular # 4 dtd nov 4, 2011Memo circular # 4 dtd nov 4, 2011
Memo circular # 4 dtd nov 4, 2011iamkim
 
Final creative shots hair & makeup evaluation (110211)
Final creative shots hair & makeup evaluation (110211)Final creative shots hair & makeup evaluation (110211)
Final creative shots hair & makeup evaluation (110211)iamkim
 
Creative shots hair & makeup evaluation (110211)
Creative shots hair & makeup evaluation (110211)Creative shots hair & makeup evaluation (110211)
Creative shots hair & makeup evaluation (110211)iamkim
 
Cat creative marching guidelines
Cat   creative marching guidelinesCat   creative marching guidelines
Cat creative marching guidelinesiamkim
 

More from iamkim (20)

Nat sci minerals part1
Nat sci   minerals part1Nat sci   minerals part1
Nat sci minerals part1
 
Batch 2012 schedule of exit interview
Batch 2012 schedule of exit interviewBatch 2012 schedule of exit interview
Batch 2012 schedule of exit interview
 
College test results b2012
College test results b2012College test results b2012
College test results b2012
 
Chem cations
Chem   cationsChem   cations
Chem cations
 
Chem anions
Chem   anionsChem   anions
Chem anions
 
Grad ball collections per section(01 28-12)
Grad ball collections per section(01 28-12)Grad ball collections per section(01 28-12)
Grad ball collections per section(01 28-12)
 
Congratulations to batch 2012 star scholar candidates
Congratulations to batch 2012 star scholar candidatesCongratulations to batch 2012 star scholar candidates
Congratulations to batch 2012 star scholar candidates
 
Retreat consent form
Retreat consent formRetreat consent form
Retreat consent form
 
Retreat agreements
Retreat agreementsRetreat agreements
Retreat agreements
 
Fil la loba negra
Fil   la loba negraFil   la loba negra
Fil la loba negra
 
Fil fray botod
Fil   fray botodFil   fray botod
Fil fray botod
 
Fil 3 q readings
Fil   3 q readingsFil   3 q readings
Fil 3 q readings
 
Dasalan at tocsohan
Dasalan at tocsohanDasalan at tocsohan
Dasalan at tocsohan
 
Chem ps electrolysis
Chem   ps electrolysisChem   ps electrolysis
Chem ps electrolysis
 
Physics waves
Physics   wavesPhysics   waves
Physics waves
 
Math 3 hw ps2
Math   3 hw ps2Math   3 hw ps2
Math 3 hw ps2
 
Memo circular # 4 dtd nov 4, 2011
Memo circular # 4 dtd nov 4, 2011Memo circular # 4 dtd nov 4, 2011
Memo circular # 4 dtd nov 4, 2011
 
Final creative shots hair & makeup evaluation (110211)
Final creative shots hair & makeup evaluation (110211)Final creative shots hair & makeup evaluation (110211)
Final creative shots hair & makeup evaluation (110211)
 
Creative shots hair & makeup evaluation (110211)
Creative shots hair & makeup evaluation (110211)Creative shots hair & makeup evaluation (110211)
Creative shots hair & makeup evaluation (110211)
 
Cat creative marching guidelines
Cat   creative marching guidelinesCat   creative marching guidelines
Cat creative marching guidelines
 

Java applet handouts

  • 1. Java Applet Handouts 1. To create an applet from BlueJ, simply click new class then the applet radio button. • Note that the classes automatically imported are: • import java.awt.*; • import javax.swing.*; 2. All applets generated will extend the JApplet class thus having to implement the ff methods: • public void init() { } • public void start() { } • public void stop() { } • public void paint(Graphics g) { } • public void destroy(){ } Methods will run in sequence displayed. To customize the look of the applet, call Graphics methods in the paint method. abstract void copyArea(int x, int y, int width, int height, int dx, int dy) Copies an area of the component by a distance specified by dx and dy. void draw3DRect(int x, int y, int width, int height, boolean raised) Draws a 3-D highlighted outline of the specified rectangle. abstract void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) Draws the outline of a circular or elliptical arc covering the specified rectangle. void drawBytes(byte[] data, int offset, int length, int x, int y) Draws the text given by the specified byte array, using this graphics context's current font and color. void drawChars(char[] data, int offset, int length, int x, int y) Draws the text given by the specified character array, using this graphics context's current font and color. abstract boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) Draws as much of the specified image as is currently available. abstract boolean drawImage(Image img, int x, int y, ImageObserver observer) Draws as much of the specified image as is currently available. abstract boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. abstract boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) Draws as much of the specified image as has already been scaled to fit inside the specified rectangle. abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. abstract boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) Draws as much of the specified area of the specified image as is currently available, scaling it on the fly to fit inside the specified area of the destination drawable surface. abstract void drawLine(int x1, int y1, int x2, int y2) Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
  • 2. abstract void drawOval(int x, int y, int width, int height) Draws the outline of an oval. abstract void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) Draws a closed polygon defined by arrays of x and y coordinates. void drawPolygon(Polygon p) Draws the outline of a polygon defined by the specified Polygon object. abstract void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) Draws a sequence of connected lines defined by arrays of x and y coordinates. void drawRect(int x, int y, int width, int height) Draws the outline of the specified rectangle. abstract void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Draws an outlined round-cornered rectangle using this graphics context's current color. abstract void drawString(AttributedCharacterIterator iterator, int x, int y) Draws the text given by the specified iterator, using this graphics context's current color. abstract void drawString(String str, int x, int y) Draws the text given by the specified string, using this graphics context's current font and color. void fill3DRect(int x, int y, int width, int height, boolean raised) Paints a 3-D highlighted rectangle filled with the current color. abstract void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) Fills a circular or elliptical arc covering the specified rectangle. abstract void fillOval(int x, int y, int width, int height) Fills an oval bounded by the specified rectangle with the current color. abstract void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) Fills a closed polygon defined by arrays of x and y coordinates. void fillPolygon(Polygon p) Fills the polygon defined by the specified Polygon object with the graphics context's current color. abstract void fillRect(int x, int y, int width, int height) Fills the specified rectangle. abstract void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) Fills the specified rounded corner rectangle with the current color. abstract Color getColor() Gets this graphics context's current color. abstract Font getFont() Gets the current font. abstract void setColor(Color c) Sets this graphics context's current color to the specified color. abstract void setFont(Font font) Sets this graphics context's font to the specified font.
  • 3. How to add Mouse Events 1. Import necessary classes: a. import java.applet.*; b. import java.awt.*; c. import java.awt.event.*; d. import javax.swing.*; 2. Add interfaces a. MouseListener b. MouseMotionListener 3. Implements necessary methods • public void mouseEntered( MouseEvent e ) { // called when the pointer enters the applet's rectangular area } • public void mouseExited( MouseEvent e ) { // called when the pointer leaves the applet's rectangular area } • public void mouseClicked( MouseEvent e ) { // called after a press and release of a mouse button // with no motion in between // (If the user presses, drags, and then releases, there will be // no click event generated.) } • public void mousePressed( MouseEvent e ) { // called after a button is pressed down } • public void mouseReleased( MouseEvent e ) { // called after a button is released } • public void mouseMoved( MouseEvent e ) { // called during motion when no buttons are down } • public void mouseDragged( MouseEvent e ) { // called during motion with buttons down } 4. Add the interface in the init function a. addMouseListener( this ); b. addMouseMotionListener( this ); 5. Additional MouseEvent Methods a. Int getClickCount() Return the number of mouse clicks associated with this event. b. Int getX() Returns the horizontal x position of the event relative to the source component. c. Int getY() Returns the vertical y position of the event relative to the source component.