chapter 4: applets and graphics 1 ©2000, john wiley & sons, inc. horstmann/java essentials, 2/e...

47
©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4: Applets and Graphics 1 Chapter 4 Applets and Graphics

Upload: justina-holland

Post on 03-Jan-2016

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics1

Chapter 4

Applets and Graphics

Page 2: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics2

Java Programs

• Console application– Plain looking terminal window

• Graphical application– User interface components (buttons, text input)

• Applets– Graphical applications that run inside a web

browser.

Page 3: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics3

Figure 1A Console Application

Page 4: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics4

Figure 2A Graphical Application

Page 5: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics5

Applets

• Web server (Store a code)• Web pages• Browser (downloaded)• Applets are programs that run inside a web

browser.• Advantage: others can access your program

– Multiple platform (java bytecode)

• Disadvantage: download time, security

Page 6: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics6

Figure 3Web Browsers Accessing a WebServer

Page 7: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics7

HTML

• <IMG SRC=“hamster.jpeg” WIDTH=640 HEIGHT=480 ALT=“A photo of Harry, the Horrible Hamster”>

• <A HREF=http://java.sun.com> Java</A> is an object-oriented programming language.

• <APPLET CODE=“HamsterApplet.calss” WIDTH=400 HEIGHT=300>An animation of Harry, the horrible Hamster</APPLET>

Page 8: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics8

A Simple Applet

– <HTML>– <BODY>– <P>Here is my first applet</P>– <APPLET CODE=“RectangleApplet.class”

WIDTH=300 HEIGHT=300>– </BODY>– </HTML>

Page 9: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics9

A Simple Applet

• appletviewer RectangleApplet.html

– public calss RectangleApplet extends Applet– { public void paint(Graphic g)– { …– }– }

Page 10: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics10

A Simple Applet

• Applets don’t have a main method.

• The web browser is responsible for starting up the Java virtual machine.

• Graphics (Object)

Page 11: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics11

Figure 4The Rectangle Applet inthe Applet Viewer

Page 12: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics12

Figure 5The Rectan-gle Applet in aJava 2–EnabledBrowser

Page 13: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics13

Program RectangleApplet.java

import java.applet.Applet;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Rectangle;

public class RectangleApplet extends Applet{ public void paint(Graphics g) { // recover Graphics2D

Graphics2D g2 = (Graphics2D)g;

// construct a rectangle and draw it

Rectangle cerealBox = new Rectangle(5, 10, 20, 30); g2.draw(cerealBox);

Page 14: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics14

// move rectangle 15 units sideways and 25 units down

cerealBox.translate(15, 25);

// draw moved rectangle

g2.draw(cerealBox); }}

Page 15: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics15

Graphical Shapes

• Ellips

• Ellipse2D.Double easterEgg = new Ellipse2D.Double(5, 10, 15, 20)

• Import java.awt.geom.Ellipse;

• Line2D.Double segment = new Line2D.Double (x1, y1, x2, y2);

Page 16: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics16

Figure 6An Ellipse and ItsBounding Box

Page 17: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics17

Colors

• RGB

• Color magenta = new Color(1.0F, 0.0F, 1.0F);

• P152

Page 18: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics18

Fonts

• G2.drawString(“Applet”, 50, 100);• final int HUGE_SIZE = 36;• String message = “Applet”;• Font hugeFont = new Font (“Serif”, Font. Bold,

Huge_SIZE);• g2.setFont(hugeFont);• g2.setColor(Color.pint);• g2.drawString(message, 50, 100);

Page 19: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics19

Figure 7Basepoint and Baseline

Page 20: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics20

Figure 8Common Fonts

Page 21: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics21

Figure 9Text Layout

Page 22: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics22

Figure 10The Font Applet

Page 23: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics23

Program FontApplet.java

import java.applet.Applet;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Font;import java.awt.font.FontRenderContext;import java.awt.font.TextLayout;

public class FontApplet extends Applet{ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g;

// select the font into the graphics context

final int HUGE_SIZE = 48; Font hugeFont = new Font("Serif", Font.BOLD, HUGE_SIZE); g2.setFont(hugeFont);

String message ="Applet";

Page 24: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics24

// create a text layout to measure the string

FontRenderContext context = g2.getFontRenderContext(); TextLayout layout = new TextLayout(message, hugeFont, context);

// measure the message width and height

float xMessageWidth = layout.getAdvance(); float yMessageHeight = layout.getAscent() + layout.getDescent();

// center the message in the window float xLeft = 0.5F * (getWidth()- xMessageWidth); float yTop = 0.5F * (getHeight()- yMessageHeight); float yBase = yTop + layout.getAscent();

g2.drawString(message, xLeft, yBase); }}

Page 25: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics25

Simple Drawings

• Car drawings

Page 26: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics26

Figure 11A Graphical Applet ThatDraws a Sketch of a Car

Page 27: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics27

Program CarDrawer.java

import java.applet.Applet;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Rectangle;import java.awt.geom.Ellipse2D;import java.awt.geom.Line2D;import java.awt.geom.Point2D;

public class CarDrawer extends Applet{ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g;

Rectangle body = new Rectangle(100, 110, 60, 10);

Ellipse2D.Double frontTire = new Ellipse2D.Double(110, 120, 10, 10); Ellipse2D.Double rearTire = new Ellipse2D.Double(140, 120, 10, 10);

Page 28: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics28

Point2D.Double r1 = new Point2D.Double(110, 110); // the bottom of the front windshield Point2D.Double r2 = new Point2D.Double(120, 100); // the front of the roof Point2D.Double r3 = new Point2D.Double(140, 100); // the rear of the roof Point2D.Double r4 = new Point2D.Double(150, 110); // the bottom of the rear windshield

Line2D.Double frontWindshield = new Line2D.Double(r1, r2); Line2D.Double roofTop = new Line2D.Double(r2, r3); Line2D.Double rearWindshield = new Line2D.Double(r3, r4);

Page 29: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics29

g2.draw(body); g2.draw(frontTire); g2.draw(rearTire); g2.draw(frontWindshield); g2.draw(roofTop); g2.draw(rearWindshield);

g2.drawString("JavaMobile 1.2ti", 100, 150); }}

Page 30: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics30

Figure 12Using Graph Paper to Find ShapeCoordinates

Page 31: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics31

Figure 13Diagrams

Page 32: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics32

Figure 14Scene

Page 33: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics33

Figure 15Manipulated Image

Page 34: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics34

Reading Text Input

• JOptionPane calss• showInputDialog method• Javax.swing package

• String input = JOPtionPane.shwInputDialog(“Please enter your age:”);

• int age = Integer.parseInt(input);\

Page 35: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics35

Figure 16An Input Dialog

Page 36: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics36

Program ColorSelect.java

import java.applet.Applet;import java.awt.Color;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Rectangle;import javax.swing.JOptionPane;

public class ColorSelect extends Applet{ public void init() { String input;

// ask the user for red, green, blue values

input = JOptionPane.showInputDialog("red:"); float red = Float.parseFloat(input);

input = JOptionPane.showInputDialog("green:"); float green = Float.parseFloat(input);

input = JOptionPane.showInputDialog("blue:"); float blue = Float.parseFloat(input); fillColor = new Color(red,green,blue); }

Page 37: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics37

public void paint(Graphics g) { final int SQUARE_LENGTH = 100;

Graphics2D g2 = (Graphics2D)g;

// select color into graphics context

g2.setColor(fillColor);

// construct and fill a square whose center is // the center of the window Rectangle square = new Rectangle( (getWidth() - SQUARE_LENGTH) / 2, (getHeight() - SQUARE_LENGTH) / 2, SQUARE_LENGTH, SQUARE_LENGTH);

g2.fill(square); }

private color fillColor;}

Page 38: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics38

Figure 17Intersection of a Line anda Circle

Page 39: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics39

Program Intersect.java

import java.applet.Applet;import java.awt.Graphics;import java.awt.Graphics2D; import java.awt.geom.Ellipse2D;import java.awt.geom.Line2D;import javax.swing.JOptionPane;

public class Intersect extends Applet{ public void init() { String input = JOptionPane.showInputDialog("x:"); x = Integer.parseInt(input);}

public void paint(Graphics g){ Graphics2D g2 = (Graphics2D)g;

double r = 100; // the radius of the circle

// draw the circle

Page 40: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics40

Ellipse2D.Double circle = new Ellipse2D.Double(0, 0, 2 * r, 2 * r); g2.draw(circle);

// draw the vertical line

Line2D.Double line = new Line2D.Double(x, 0, x, 2 * r); g2.draw(line);

// compute the intersection points

double a = r; double b = r;

Page 41: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics41

double root = Math.sqrt(r * r - (x - a) * (x - a)); double y1 = b + root; double y2 = b - root;

// draw the intersection points

final double SMALL_CIRCLE_RADIUS = 2;

Ellipse2D.Double circle1 = new Ellipse2D.Double( x - SMALL_CIRCLE_RADIUS, y1 - SMALL_CIRCLE_RADIUS, 2 * SMALL_CIRCLE_RADIUS, 2 * SMALL_CIRCLE_RADIUS); Ellipse2D.Double circle2 = new Ellipse2D.Double( x - SMALL_CIRCLE_RADIUS, y2 - SMALL_CIRCLE_RADIUS, 2 * SMALL_CIRCLE_RADIUS, 2 * SMALL_CIRCLE_RADIUS);

Page 42: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics42

g2.draw(circle1); g2.draw(circle2);

// label the intersection points

String label1 = "” + y1; String label2 = "” + y2;

g2.drawString(label1, (float)x, (float)y1); g2.drawString(label2, (float)x, (float)y2);

}

private double x;

}

Page 43: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics43

Program Phoenix.java

import java.applet.Applet;import java.awt.Graphics;import java.awt.Graphics2D;import java.awt.Rectangle;

public class Phoenix extends Applet{ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D)g; month = 0; units = new UnitConverter(0, 12, 0, 40, getWidth(), getHeight()); final int JAN_TEMP = 11; final int FEB_TEMP = 13; final int MAR_TEMP = 16; final int APR_TEMP = 20; final int MAY_TEMP = 25; final int JUN_TEMP = 31; final int JUL_TEMP = 33; final int AUG_TEMP = 32; final int SEP_TEMP = 29;

Page 44: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics44

final int OCT_TEMP = 23; final int NOV_TEMP = 16; final int DEC_TEMP = 12;

drawBar(g2, JAN_TEMP); drawBar(g2, FEB_TEMP); drawBar(g2, MAR_TEMP); drawBar(g2, APR_TEMP); drawBar(g2, MAY_TEMP); drawBar(g2, JUN_TEMP); drawBar(g2, JUL_TEMP); drawBar(g2, AUG_TEMP); drawBar(g2, SEP_TEMP); drawBar(g2, OCT_TEMP); drawBar(g2, NOV_TEMP); drawBar(g2, DEC_TEMP);}

Page 45: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics45

public void drawBar(Graphics2D g2, int temperature) { // construct rectangle for this month and temperature

Rectangle rect = new Rectangle(month, 0, 1, temperature); // convert to pixel coordinates and draw

units.convert(rect); g2.draw(rect);

month++; }

private int month; private UnitConverter units;}

Page 46: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics46

Figure 18Plotting Temperature Data

Page 47: Chapter 4: Applets and Graphics 1 ©2000, John Wiley & Sons, Inc. Horstmann/Java Essentials, 2/e Chapter 4 Applets and Graphics

©2000, John Wiley & Sons, Inc.Horstmann/Java Essentials, 2/e

Chapter 4: Applets and Graphics47

Figure 19A Tic-Tac-ToeBoard