Write a program on clearing rectangles, JAVA Programming

Assignment Help:

Write a program on clearing Rectangles ?

It is also potential to clear a rectangle that you've drawn. The syntax is exactly what you'd expect:

public abstract void clearRect(int x, int y, int width, int height)
This program uses clearRect() to blink a rectangle on the screen.
import java.applet.*;
import java.awt.*;

public class Blink extends Applet {

public void paint(Graphics g) {

int appletHeight = this.getSize().height;
int appletWidth = this.getSize().width;
int rectHeight = appletHeight/3;
int rectWidth = appletWidth/3;
int rectTop = (appletHeight - rectHeight)/2;
int rectLeft = (appletWidth - rectWidth)/2;

for (int i=0; i < 1000; i++) {
g.fillRect(rectLeft, rectTop, rectWidth-1, rectHeight-1);
g.clearRect(rectLeft, rectTop, rectWidth-1, rectHeight-1);
}

}

}
This is not how you should do animation in practice, but this is the best we can do until we introduce threads.


Related Discussions:- Write a program on clearing rectangles

Create an applet for grid layout, Take the Student Choice GUI you created i...

Take the Student Choice GUI you created in Assignment and convert it to an applet.  Because standalone GUI applications and applets are so similar, a lot of the code should be reus

Programming, .Write a programme to create a webpage that prints the name of...

.Write a programme to create a webpage that prints the name of the STUDENT database in Wide Latin font and set the subtitle with description of the STUDENT to the screen. Set the

Palindrome, A palindrome is a string that reads the same from both the ends...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

What are the two important tcp socket classes, Socket and ServerSocket. Ser...

Socket and ServerSocket. ServerSocket is used for normal two-way socket communication. Socket class permits us to read and write by the sockets. getInputStream() and getOutputStrea

Types of dependency injection spring supports, What are the types of Depend...

What are the types of Dependency Injection Spring supports? Ans) there are two types of Dependency Injection Spring a)  Setter Injection: b)  Constructor Injection:

Java script, var temp =14; var y = 2; temp document.write(temp);

var temp =14; var y = 2; temp document.write(temp);

Student, short Java application that stores words in an Array or ArrayList....

short Java application that stores words in an Array or ArrayList.

Package inheritance hierarchy program, (Package Inheritance Hierarchy) Pack...

(Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping options, each with specific costs associated. Create

Annotation or attribute oriented programming? , Annotation or Attribute ori...

Annotation or Attribute oriented programming There are two types of code generation processes. Passive code generation: is template driven . Input process are used in mo

In programming what is an object, In programming, what is an object? Ob...

In programming, what is an object? Object is a named collection of properties (data and state) & methods (instructions, behaviour). Objects are key to understanding object-orie

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd