Java Applet Presented by Fitsum Okubu. Introduction Introduction Graphics Graphics Methods and Variables Methods and Variables Events Events Decision.

Slides:



Advertisements
Similar presentations
Java GUI building with the AWT. AWT (Abstract Window Toolkit) Present in all Java implementations Described in (almost) every Java textbook Adequate for.
Advertisements

Life Cycle of an Applet, along with response to mouse events and other simple features. (ps:only two possible examples for life circle of an Applet)
LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Programming and Problem Solving With Java Copyright 1999, James M. Slack Applets What is an Applet? Applet Parameters Graphics in Applets Other Applet.
Mouse Events and Keyboard Events
Copyright 2008 by Pearson Education Building Java Programs Graphics Reading: Supplement 3G.
Lecture 24 Applets. Introduction to Applets Applets should NOT have main method but rather init, stop, paint etc They should be run through javac compiler.
A Simple Applet. Applets and applications An applet is a Java program that runs on a web page –Applets can be run from: Internet Explorer Netscape Navigator.
Copyright 2006 by Pearson Education 1 Building Java Programs Supplement 3G: Graphics.
A Simple Applet.
Program Design With Methods And Graphics / Chapter 4 1 Abstract Window Toolkit.
1 Graphical objects We will draw graphics in Java using 3 kinds of objects: DrawingPanel : A window on the screen. Not part of Java; provided by the authors.
Programming Task: Task 1 Controlled Assessment Practice.
Graphics. Graphics Features in Java Topics to be covered Topics to be covered Graphics Basics Graphics Basics Coordinate System Coordinate System Graphics,
Chapter 9: Applets Jim Burns Fall Outline Learn about applets Learn about applets Write an HTML doc to host an applet Write an HTML doc to host.
Applets Java API.
Agenda For Feb Finish up Unit 3 Exercises on page Unit 4 Exercises on page 33. Question #2 3. Create a Happy Face Java Applet (due next class).
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Java applet basics, loading & displaying images After this section, you should be able to : –Use the applet tag and applet parameters –Describe what a.
Java On The Web Session 15. Memory Upload JAVA Applets Colors Fonts Drawing Methods Posting your Applet.
JAPPLET.
Learn about the types of Graphics that are available Develop a basic Graphics applet Develop a basic Graphics application Review the Java API and use.
Abstract Window Toolkit (AWT) The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include:  A rich set.
Events Chapter Six. Old (procedural) vs. OOPS Programs §OOPS programs react to the users demands §Anytime/anyplace §EVENT = “An Action taken by a user”
Applets Applet is java program that can be embedded into HTML pages. Java applets runs on the java enabled web browsers such as mozilla and internet explorer.
7/3/00SEM107- © Kamin & ReddyClass 11 - Events - 1 Class 11 - Events r A couple of odds & ends m Component sizes  switch statement r Event types r Catching.
1 A Simple Applet. 2 Applets and applications An application is an “ordinary” program Examples: Notepad, MS Word, Firefox, Halo, etc. An applet is a Java.
1 Block1 – unit 2 (The Case study in Budd 5-6).  create a small application that uses the Abstract Windowing Toolkit (AWT)  Swing packages to simulate.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Introduction to Java Simple Graphics. Objects and Methods Recall that a method is an action which can be performed by an object. –The action takes place.
Program that runs in appletviewer (test utility for applets) Web browser (IE, Communicator) Executes when HTML (Hypertext Markup Language) document containing.
MSc Workshop - © S. Kamin, U.Reddy Lect 4 - Events - 1 Lecture 4 – Event Handling r Painting r Event types r Catching different event types.
CPS Today’s topics Java Applications Graphics Upcoming Review for Midterm Exam Reading Great Ideas, Chapters 5.
12/5/00SEM107, Kamin & ReddyReview - 34 Events Event types Catching different event types Getting information from components and events Distinguishing.
Lec 16 Adding Mouse and KeyEvent handlers to an Applet Class.
APPLET. 2 Introduction to Java Applet Programs Applications are stand alone programs ◦ executed with Java interpreter Applet is a small program ◦ can.
1 Building Java Programs Supplement 3G: Graphics These lecture notes are copyright (C) Marty Stepp and Stuart Reges, They may not be rehosted, sold,
Java Applets: GUI Components, Events, Etc. Ralph Westfall June, 2010.
Applets Yong Choi School of Business CSU, Bakersfield.
Intro to Applets. Applet Applets run within the Web browser environment Applets bring dynamic interaction and live animation to an otherwise static HTML.
25/2/00SEM107 - © Kamin & ReddyClass 9 - HTML - 1 Class 9 - HTML r Creating a personal web page r Structure of HTML documents r HTML tags r The APPLET.
Objects and Classes Chapter Nine. Definition “an object is a combination of some data (variables) and some actions (methods)”. Hopefully the data and.
Applets. Internet/WWW How does it work? Internet/WWW.
1 A Simple Applet. 2 Applets and applications An applet is a Java program that runs on a web page Applets can be run within any modern browser To run.
CSI 3125, Preliminaries, page 1 Applet. CSI 3125, Preliminaries, page 2 Graphics Methods public abstract void drawString(String str, int x, int y): is.
CS305j Introduction to Computing Simple Graphics 1 Topic 11 Simple Graphics "What makes the situation worse is that the highest level CS course I've ever.
Introduction to Graphics. Graphical objects To draw pictures, we will use three classes of objects: –DrawingPanel : A window on the screen. –Graphics.
Copyright 2008 by Pearson Education Building Java Programs Graphics reading: Supplement 3G videos: Ch. 3G #1-2.
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
CSC 205 Programming II Lecture 5 AWT - I.
Lecture 09 Applets.
Decisions - if and switch
Object Oriented Programming
Building Java Programs
Java Applet.
Building Java Programs
Building Java Programs
Building Java Programs
Today’s topics Java Applications Upcoming Reading Graphics
Ellen Walker Hiram College
Building Java Programs
Applet in Java.
Building Java Programs
Building Java Programs
Building Java Programs
Building Java Programs
GUI building with the AWT
Building Java Programs
Graphics Reading: Supplement 3G
APPLET PROGRAMMING.
Presentation transcript:

Java Applet Presented by Fitsum Okubu

Introduction Introduction Graphics Graphics Methods and Variables Methods and Variables Events Events Decision – if clause Decision – if clause Creating and using of buttons and textfields. Creating and using of buttons and textfields. Repetition – while, for and do Repetition – while, for and do Objects and Classes Objects and Classes

Java applet and application –Java programs are of two distinct types: applications applications applets applets Both types are programs. Both types are programs. The difference is that an application is a completely free- standing program. That means it is not part of any other program and it doesn’t need any other program to launch it. In contrast an applet is invoked as part of a Web page and therefore needs either a Web browser or an applet viewer to invoke it. The difference is that an application is a completely free- standing program. That means it is not part of any other program and it doesn’t need any other program to launch it. In contrast an applet is invoked as part of a Web page and therefore needs either a Web browser or an applet viewer to invoke it.

Graphics Graphics Applet can be used to display animated images Applet can be used to display animated images Java graphics are based on pixels. Java graphics are based on pixels. Each pixel is identified by a pair of numbers (its coordinates), starting from zero. Each pixel is identified by a pair of numbers (its coordinates), starting from zero. –The horizontal position is, often referred to as x in mathematics (and in java documentation) – this value increases from left to right. –The vertical postion, often referred to as y – increases downwards. Java provides us with facilities for drawing: drawRect drawRect –the horizontal value of the top left corner. –the vertical value of the top left corner. –the with of the rectangle. –the height of the rectangle. drawOval –Imagine the oval squeezed inside a rectangle.  the horizontal value of the top left corner of the rectangle.  the vertical value of the top left corner of the rectangle.  the width of the rectangle.  the height of the rectangle.

Example1 Example1 Example1 import java.awt.*; import java.applet.Applet; public class Example1 extends Applet{ public void paint (Graphics g){ g.drawRect(30,30,80,40); g.drawOval(120,30, 50,50); g.setColor(Color.blue); g.fillRect(30,100, 80,40); g.setColor(Color.orange);g.fillOval(120,100,50,50);g.drawLine(30,160,130,170);}} Example1 Example1 <applet code="Example1.class" width= 300 height=200> width= 300 height=200>

Methods and Parameters Methods and Parameters Large programs can be complex, with the result that they can be difficult to understand and debug. The most significant technique for reducing complexity is to split a into isolated sections called methods. Large programs can be complex, with the result that they can be difficult to understand and debug. The most significant technique for reducing complexity is to split a into isolated sections called methods.Example2 import java.awt.*; import java.applet.Applet; public class Example2 extends Applet{ public void paint(Graphics g){ drawHouse(g, 50,50,70,30); drawHouse(g, 100,50,60,20); } private void drawTriangle(Graphics g, int bottomX, int bottomY, int base, int height){ int base, int height){ g.drawLine(bottomX, bottomY, bottomX+base, bottomY); g.drawLine(bottomX+base, bottomY, bottomX + base/2, bottomY-height); g.drawLine(bottomX+base/2, bottomY-height,bottomX, bottomY); } private void drawHouse(Graphics g, int bottomX, int bottomY, int width, int height){ int width, int height){g.setColor(Color.cyan); g.drawRect(bottomX, bottomY-height, width, height); g.drawRect(bottomX, bottomY-height, width, height);g.setColor(Color.orange); drawTriangle(g, bottomX, bottomY-height, width, height/2); }} HTML code to invoke the program Example2 Example2 <applet code="Example2.class" width= 300 height=200> width= 300 height=200>

Events Events In programming an event is (in most cases) an action taken by the user. Scrollbar events - AdjustmentListener Scrollbar events - AdjustmentListener First we need to state that we are going to implement a listener for scrollbar events, which are classified in AdjustmentListener. We then register our program as a listener by using the addAdjustmentListener method, which is in effect causes our simple program, our adjustmentValueChanged method simply fetches the new value from the scrollbar, and arranges for it to be painted on the screen. First we need to state that we are going to implement a listener for scrollbar events, which are classified in AdjustmentListener. We then register our program as a listener by using the addAdjustmentListener method, which is in effect causes our simple program, our adjustmentValueChanged method simply fetches the new value from the scrollbar, and arranges for it to be painted on the screen.

Example3(Creating scrollbars) Example3(Creating scrollbars) import java.awt.*; import java.applet.Applet;import java.awt.event.*; public class Colors extends Applet implements AdjustmentListener { private Scrollbar red; private Scrollbar green; private Scrollbar red; private Scrollbar green; private Scrollbar blue; private Scrollbar blue; private int redValue = 0; private int redValue = 0; private int greenValue = 0; private int greenValue = 0; private int blueValue = 0; private int blueValue = 0; public void init() { public void init() { Label l1, l2, l3; Label l1, l2, l3; l1 = new Label("Red:"); l1 = new Label("Red:"); l2 = new Label("Green:"); l2 = new Label("Green:"); l3 = new Label("Blue:"); l3 = new Label("Blue:"); red = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); red = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); green = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); green = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); blue = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); blue = new Scrollbar(Scrollbar.VERTICAL, 0, 0, 0, 256); add(l1); add(l1); add(red); add(red); add(l2); add(l2); add(green); add(green); add(l3); add(l3); add(blue); add(blue); red.addAdjustmentListener(this); red.addAdjustmentListener(this); green.addAdjustmentListener(this); green.addAdjustmentListener(this); blue.addAdjustmentListener(this); blue.addAdjustmentListener(this); } public void adjustmentValueChanged(AdjustmentEvent e) { public void adjustmentValueChanged(AdjustmentEvent e) { Color c1; Color c1; redValue = red.getValue(); redValue = red.getValue(); greenValue = green.getValue(); greenValue = green.getValue(); blueValue = blue.getValue(); blueValue = blue.getValue(); showStatus("Red is: " + redValue + "; Green is: " + greenValue + "; Blue is: " + blueValue); showStatus("Red is: " + redValue + "; Green is: " + greenValue + "; Blue is: " + blueValue); c1 = new Color(redValue, greenValue, blueValue); c1 = new Color(redValue, greenValue, blueValue); setBackground(c1); setBackground(c1);}} //html code Example3 //html code Example3

Decisions – if (Example4) Decisions – if (Example4) import java.awt.*; import java.applet.Applet; import java.awt.event.*; public class Example4 extends Applet implements AdjustmentListener{ private Scrollbar tom, jerry; private int tomValue= 0, jerryValue = 0; public void init(){ Label toms = new Label("Tom"); add(toms); tom = new Scrollbar(Scrollbar.HORIZONTAL, 0,1,0,100); add(tom);tom.addAdjustmentListener(this); Label jerrys = new Label("Jerry:"); add(jerrys); jerry = new Scrollbar(Scrollbar.HORIZONTAL, 0,1,0,100); add(jerry);jerry.addAdjustmentListener(this);} public void paint(Graphics g){ g.drawString("Tom", 5, 70); g.fillRect(40,60,tomValue,10); g.drawString("Jerry", 5, 85); g.fillRect(40, 75, jerryValue, 10); if (tomValue > jerryValue) g.drawString("Tom is bigger", 50,50); else g.drawString("Jerry is bigger", 50,50); }

Continuation of Example4 Continuation of Example4 public void adjustmentValueChanged(AdjustmentEvent event){ tomValue = tom.getValue(); jerryValue = jerry.getValue(); repaint();}} HTML code to invoke the program Example4 Example4 <applet code="Example4.class" width= 300 height=200> width= 300 height=200>

Buttons Buttons As with scrollbars, use of buttons is accomplished using methods on one of the Java libraries, the AWT (Abstract Window Toolkit) library. As with scrollbars, use of buttons is accomplished using methods on one of the Java libraries, the AWT (Abstract Window Toolkit) library. The are six steps to setting up a button: The are six steps to setting up a button: - State that the class implements ActionsListener. - State that the class implements ActionsListener. - Declare a button variable, giving it a name. - Declare a button variable, giving it a name. - Create a new button, giving it a label. - Create a new button, giving it a label. - Add the button to the window - Add the button to the window - Inform the button that this object will respond to - Inform the button that this object will respond to button events, using addActionListener. button events, using addActionListener. - Provide a method called actionPerformed to be - Provide a method called actionPerformed to be invoked when a button click event occurs. invoked when a button click event occurs.

Example5 (creating and using Buttons) Example5 (creating and using Buttons) import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Example5 extends Applet implements ActionListener{ private int diameter = 20; private Button little, large; public void init(){ little = new Button("Little"); add(little);little.addActionListener(this); large = new Button("Large"); add(large);large.addActionListener(this);} public void paint(Graphics g){ public void paint(Graphics g){ g.setColor(Color.blue); g.setColor(Color.blue); g.fillOval(25, 25, diameter, diameter); g.fillOval(25, 25, diameter, diameter); } public void actionPerformed(ActionEvent event){ public void actionPerformed(ActionEvent event){ if (event.getSource() == little) if (event.getSource() == little) diameter = diameter - 10; if (event.getSource()== large) diameter = diameter + 10; repaint(); }} Example5 Example5 <applet code="Example5.class" width= 300 height=200> width= 300 height=200>

Creating and Using Text Fields Creating and Using Text Fields import java.applet.*; import java.awt.*; import java.awt.event.*; public class Example6 extends Applet implements ActionListener{ private Button ageB; private TextField ageField; private int age; public void init(){ ageField = new TextField(10); add(ageField);ageField.addActionListener(this); ageB = new Button("MyAge"); add(ageB);ageB.addActionListener(this);} public void actionPerformed(ActionEvent event){ if (event.getSource() == ageB) if (event.getSource() == ageB) age = Integer.parseInt(ageField.getText()); age = Integer.parseInt(ageField.getText()); repaint(); repaint();} public void paint(Graphics g){ setBackground(Color.orange); setBackground(Color.orange); g.drawString("Age is " + age, 50, 50); if (age >= 18) g.drawString("You can vote", 50, 100); else g.drawString("You can not vote", 50,100) }} Example6 Example6 <applet code="Example6.class" width= 300 height=200> width= 300 height=200>

Repetitions – while, for and do Repetitions – while, for and do While loop (Example7) While loop (Example7) import java.awt.*; import java.applet.Applet; public class Example7 extends Applet{ public void paint(Graphics g){ int counter, x =5; counter = 0; while (counter < 8){ setBackground(Color.blue); setBackground(Color.blue); g.drawString("*", x, 20); x = x + 10; counter++; } }} HTML code to invoke the program Example7 Example7 <applet code="Example7.class" width= 300 height=200> width= 300 height=200>

For Loop For Loop In the for loop, many of the ingredients of the while loop are bundled up together in the statement itself. Example8 (how to use a for loop) import java.awt.*; import java.applet.Applet; public class Example8 extends Applet{ public void paint(Graphics g){ int n = 0; int x = 20; int y = 20; for (int i = 0; i < 8; i++){ setBackground(Color.cyan); setBackground(Color.cyan); g.drawLine(x, y, x + 100, y); y = y + 10; n++;}}} HTML code to invoke the program Example8 Example8 <applet code="Example8.class" width= 300 height=200> width= 300 height=200>

do loop do loop Example9 import java.awt.*; import java.applet.Applet; public class Example9 extends Applet{ public void paint(Graphics g){ int countOfSquares = 0; int countOfSquares = 0; int riceOnThisSquare = 1; int totalRice = 0; int y=20; do{ countOfSquares++; countOfSquares++; g.drawString("On Square" + countOfSquares + "are" + riceOnThisSquare, 10,y); g.drawString("On Square" + countOfSquares + "are" + riceOnThisSquare, 10,y); totalRice = totalRice + riceOnThisSquare; totalRice = totalRice + riceOnThisSquare; riceOnThisSquare = riceOnThisSquare * 2; riceOnThisSquare = riceOnThisSquare * 2; y=y+20; y=y+20; } while (totalRice < 100); while (totalRice < 100); g.drawString("Number of squares needed is " + countOfSquares, 10, y + 10); g.drawString("Number of squares needed is " + countOfSquares, 10, y + 10);}} html code to invoke Example9 class Example8 Example8 <applet code="Example8.class" width= 300 height=200> width= 300 height=200>

Objects and Classes Objects and Classes Object-oriented programming is about constructing programs form objects. An object is a combination of some data (variables) and some actions (methods). Object-oriented programming is about constructing programs form objects. An object is a combination of some data (variables) and some actions (methods). In Object Programming languages a class is the specification of for any number of objects that are the same. Once a class has been described, a particular object constructed by creating an instance of the class. In Object Programming languages a class is the specification of for any number of objects that are the same. Once a class has been described, a particular object constructed by creating an instance of the class.

Example10 – Creating a class or Object Example10 – Creating a class or Object import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class Example10 extends Applet implements ActionListener, AdjustmentListener{ ActionListener, AdjustmentListener{ private Button grow, shrink, left,right, vertGrow,vertShrink; private Button grow, shrink, left,right, vertGrow,vertShrink; private Circle myCircle; private Circle myCircle; private Scrollbar red; private Scrollbar red; private Scrollbar green; private Scrollbar green; private Scrollbar blue; private Scrollbar blue; private int redValue; private int redValue; private int greenValue; private int greenValue; private int blueValue; private int blueValue; private Color color; private Color color;

Continuation of Example 10 Continuation of Example 10 public void init(){ grow = new Button("Grow"); grow = new Button("Grow"); add(grow); add(grow); grow.addActionListener(this); grow.addActionListener(this); shrink = new Button("Shrink"); shrink = new Button("Shrink"); add(shrink); add(shrink); shrink.addActionListener(this); shrink.addActionListener(this); left = new Button("left"); left = new Button("left"); add(left); add(left); left.addActionListener(this); left.addActionListener(this); right = new Button("right"); right = new Button("right"); add(right); add(right); right.addActionListener(this); right.addActionListener(this); vertGrow = new Button("Vertical Grow"); vertGrow = new Button("Vertical Grow"); add(vertGrow); add(vertGrow); vertGrow.addActionListener(this); vertGrow.addActionListener(this); vertShrink = new Button("Vertical Shrink"); vertShrink = new Button("Vertical Shrink"); add(vertShrink); add(vertShrink); vertShrink.addActionListener(this); vertShrink.addActionListener(this); Label l1, l2, l3; Label l1, l2, l3; l1 = new Label("Red:"); l1 = new Label("Red:"); l2 = new Label("Green:"); l2 = new Label("Green:"); l3 = new Label("Blue:"); l3 = new Label("Blue:"); red = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); red = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); green = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); green = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); blue = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); blue = new Scrollbar(Scrollbar.HORIZONTAL,0,1,0,1000); add(l1); add(l1); add(red); add(red); add(l2); add(l2); add(green); add(green); add(l3); add(l3); add(blue); add(blue); red.addAdjustmentListener(this); red.addAdjustmentListener(this); green.addAdjustmentListener(this); green.addAdjustmentListener(this); blue.addAdjustmentListener(this); blue.addAdjustmentListener(this); myCircle = new Circle(); myCircle = new Circle();}

Continuation of Example 10 Continuation of Example 10 public void adjustmentValueChanged(AdjustmentEvent event){ redValue = red.getValue(); redValue = red.getValue(); greenValue = green.getValue(); greenValue = green.getValue(); blueValue = blue.getValue(); blueValue = blue.getValue(); color = new Color(redValue, greenValue,blueValue); color = new Color(redValue, greenValue,blueValue); showStatus("Red is: " + redValue + showStatus("Red is: " + redValue + "; Green is:" + greenValue + "; Green is:" + greenValue + "; Blue is: " + blueValue); "; Blue is: " + blueValue); repaint(); repaint(); } public void actionPerformed(ActionEvent event){ if (event.getSource() == grow ) if (event.getSource() == grow ) myCircle.grow(); myCircle.grow(); if (event.getSource() == shrink) if (event.getSource() == shrink) myCircle.shrink(); myCircle.shrink(); if (event.getSource() == left) if (event.getSource() == left) myCircle.left(); myCircle.left(); if (event.getSource() == right) if (event.getSource() == right) myCircle.right(); myCircle.right(); if (event.getSource() == vertGrow) if (event.getSource() == vertGrow) myCircle.vertGrow(); myCircle.vertGrow(); if (event.getSource() == vertShrink) if (event.getSource() == vertShrink) myCircle.vertShrink(); myCircle.vertShrink(); repaint(); repaint();}

Continuation of Example 10 Continuation of Example 10 public void paint(Graphics g){ g.setColor(color); g.setColor(color); myCircle.display(g); myCircle.display(g); }} class Circle{ class Circle{ private int height = 10; private int height = 10; private int width = 10; private int width = 10; private int xCoord = 20, yCoord = 50; private int xCoord = 20, yCoord = 50; private int red = 0; private int red = 0; private int greeen = 0; private int greeen = 0; private int blue = 0; private int blue = 0; private Color color; private Color color; public void display(Graphics g){ public void display(Graphics g){ g.fillOval(xCoord, yCoord,width, height); g.fillOval(xCoord, yCoord,width, height); } public void left(){ public void left(){ xCoord = xCoord - 10; xCoord = xCoord - 10; } public void right(){ public void right(){ xCoord = xCoord + 10; xCoord = xCoord + 10; } public void grow(){ public void grow(){ width = width + 10; width = width + 10; height = height +10; height = height +10; } public void shrink(){ public void shrink(){ width = width - 10; width = width - 10; height = height -10; height = height -10; } public void vertGrow(){ public void vertGrow(){ height = height + 10; height = height + 10; }

Continuation of Example 10 Continuation of Example 10 public void vertShrink(){ height = height - 10; height = height - 10; } public void newColor(int red, int green,int blue){ public void newColor(int red, int green,int blue){ color = new Color(red,green,blue); color = new Color(red,green,blue); } }<html><head> Web page Example10 Web page Example10 </head><body> </applet></body></html>

Questions? Questions?