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

Java Gui, Does the java applet using swing components, JAVA Programming on ...

Does the java applet using swing components, JAVA Programming on this contain all the source codes for download?

Name conflicts when importing packages, Name Conflicts when importing packa...

Name Conflicts when importing packages It is possible which you will try to import a package which contains classes in which have the similar name as a class in your own source

Describe synchronization in respect to multithreading, Describe synchroniza...

Describe synchronization in respect to multithreading. With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared res

Program, write code employe managment

write code employe managment

Difference between a stringbuffer and a string class?, String is immutabl...

String is immutable in java : you can't change a string object but can replace it by creating a new object instance. Creating a new instance is rather expensive.   //Non ef

Reading or writing disk files, For this assignment, you will simulate a fil...

For this assignment, you will simulate a file system. You will be neither creating files nor reading or writing disk files. Rather, you will have a simulation of a file system that

Prob, hi there I have some problem on java .. can u do it for me

hi there I have some problem on java .. can u do it for me

What is numeric promotion, What is numeric promotion? Numeric promotion...

What is numeric promotion? Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integer and floating-point operations may take place.

Write a program to add of doubles in java, Write a program to add of double...

Write a program to add of doubles in java? Doubles are treated much the similar way, but now you obtain to use decimal points in the numbers. This is a same program which does

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