Midterm I Review

Midterm I Review

Java On The Web Session 15 Memory Upload JAVA Applets Colors

Fonts Drawing Methods Posting your Applet Applets An applet is a program that runs embedded in HTML code They must be viewed either in Web Browser Appletviewer GUI Elements

Applets can display GUI elements Graphical User Interface Colors Fonts Text-Fields, Button Butt , Labels, etc. on Skeleton import java.awt.*; import java.applet;

public class MyApplet extends Applet { public void init( ){ } public void paint(Graphics g){ //instructions go here } } Skeleton import java.awt.*; import java.applet; public class MyApplet extends Applet {

public void init( ){ } public void paint(Graphics g){ //instructions go here } } Colors Colors are made out of 3 values Each value goes from 0 to 255 RED GREEN

BLUE Colors Black Color.black 0,0,0 Blue Color.blue

0,0,255 Cyan Color.cyan 0,255,255 Gray Color.gray

128,128,128 Green Color.green 0,255,0 Magenta Color.magenta 255,0,255

Orange Color.orange 255,200,0 Pink Color.pink 255,175,175

Red Color.red 255,0,0 White Color.white 255,255,255

Yellow Color.yellow 255,255,0 Colors import java.awt.*; import java.applet; public class MyApplet extends Applet { public void init( ){

} public void paint(Graphics g){ //Your Own Color MyColor = new Color(50, 200,150); g.setColor(MyColor); } } .setColor(Color) g.setColor(Color.yellow); g.setColor(Color.red); g.setColor(MyColor);

Fonts The constructor Font f = new Font(Type, Style, Size); import java.awt.*; import java.applet; public class MyApplet extends Applet { public void init( ){a } public void paint(Graphics g){ Font f=new Font(Tahoma,Font.PLAIN, 10);

g.setFont(f); } } Methods void drawLine(int x1, int y1, int x1, int y2) void drawRect(int x, int y, int w, int h) void fillRect((int x, int y, int w, int h) void drawOval(int x, int y, int w, int h) void fillOval(int x, int y, int w, int h) void drawString(String, int x, int y) void drawArc(int x, int y, int w, int h,

int start angle, int arcAngle) void fillArc(int x, int y, int w, int h, int start angle, int arcAngle) The coordinates 0,0 x y drawLine 0,0

10 10 24 18 g.drawLine(10,10,18,24); drawRect 0,0 10

10 8 10 g.setColor(Color.green); g.drawRect(10,10,8,10); fillRect 0,0 10

10 8 10 g.setColor(Color.green); g.fillRect(10,10,8,10); drawOval 0,0 10

10 8 10 g.setColor(Color.red); g.drawOval(10,10,8,10); fillOval 0,0 10

10 8 10 g.setColor(Color.red); g.fillOval(10,10,8,10); drawArc 0,0 10

10 8 10 g.setColor(Color.blue); g.drawArc(10,10,8,10,0,45); fillArc 0,0 10

10 8 10 g.setColor(Color.blue); g.fillArc(10,10,8,10,0,45); drawString 0,0 10

10 Blanca g.setColor(Color.Magenta); g.setFont(Arial,Font.PLAIN, 30); g.drawString(Blanca,10,10); Posting Your Applet Write your JAVA code Compile your code Make it available

The Applet Tag Substitute www and hhh for your own width and height. Substitute YourClass.class with the name of your own class. The Applet tag should be regarded as any other

html tag inside your HTML page. Time to Try it Out Applets on the Web Memory Defragmenter

Drawing Applet Skeleton Drawing Methods Colors Fonts Posting Applets in the Web E-mail any questions to [email protected] Task Manager

Post the sample applet from webct on the web, in your website. Read your e-mail Visit WebCT, webct.hawaii.edu Task Manager Post the sample applet from webct on the web, in your website. Read your e-mail Visit WebCT, webct.hawaii.edu

Recently Viewed Presentations

  • Marxist Criticism

    Marxist Criticism

    The end result of this process is absolute knowledge. This process can be said to be dialectical. Karl Marx (1818-83): Philosophers have only interpreted the world, in various ways; the point, however, is to change it. Marx took Hegel's idealistic...
  • The ACUTE Trial Ambulance CPAP Use, Treatment Effect

    The ACUTE Trial Ambulance CPAP Use, Treatment Effect

    My name is Gordon Fuller. I'm an Emergency Medicine registrar working in South Yorkshire and a clinical lecturer working in the Centre for Urgent and Emergency Care Research at the University of Sheffield. Thank you very much for your interest...
  • Juvenile Justice in Missouri - Joplin Business Department

    Juvenile Justice in Missouri - Joplin Business Department

    The judge can place the juvenile in a group home or place the juvenile in a juvenile detention center or other institution. In deciding what to do with the juvenile car thieves, the judge will consider each boy's attitude, number...
  • A closer Look inside Oracle ASM - CERN

    A closer Look inside Oracle ASM - CERN

    A Closer Look inside Oracle ASM ... Arial Tahoma Times New Roman Comic Sans MS Times Courier New Default Design Microsoft Office Excel Chart A Closer Look inside Oracle ASM Outline ASM ASM for a Clustered Architecture ASM Disk Groups...
  • Social Media Engagement for Emergency Management

    Social Media Engagement for Emergency Management

    UNCLASSIFIED//FOUO. UNCLASSIFIED//FOUO. We see benefit to a standardized way the state incorporates Social Media into Emergency Management. We recommend forming a state-level working group focused on Social Media use during Emergency Management. Initial focus could be to ensure every county...
  • Office of Information Technology Tracy Futhey VP of

    Office of Information Technology Tracy Futhey VP of

    Julian Lombardi Assistant Vice President, Academic & Research Services. Bob Johnson. Senior Strategist, Global IT & Senior Director, Communications Infrastructure. ... Glenn Setliff Sr. School of Nursing. Primary Support of CIO Functions.
  • Kolossense 2:6-19 God nooi ons uit en ons

    Kolossense 2:6-19 God nooi ons uit en ons

    Of vertel die storie en wys prente direk van 'n tablet of die e-Reader op jou rekenaar. Carolyn Brown (worshippingwithchildren.blogspot.com) sĂȘ die probleem vir die Kolossense is dat mense dit meer ingewikkeld gemaak het om 'n Christen te wees as...
  • 8TH GRADE SCIENCE LEAF PROJECT - Auburn Middle School

    8TH GRADE SCIENCE LEAF PROJECT - Auburn Middle School

    LEAF PRESENTATION HOLLY SASSAFRAS REDBUD BOXELDER Chestnut, Horse SWEETGUM Ash Birch CATALPA WILLOW, WEEPING BUCKEYE, OHIO GINKGO ELM, AMERICAN Elm, Slippery Hawthorn, Green Maple, Red MAPLE, SUGAR BALDCYPRESS HACKBERRY MAPLE, SILVER MIMOSA HICKORY, SHAGBARK MULBERRY, RED COTTONWOOD LOCUST, HONEY PINE,...