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

Use array to store values in a program, 1) Listing of the source code ( nam...

1) Listing of the source code ( named Rainfall.java ) for your program 2) Two sample output/execution/runs of your program Optional Group Work: This assignment may be done in

Data types in javascript, A value, the data assigned to a variable, may con...

A value, the data assigned to a variable, may contain any sort of data. Though, JavaScript considers data to fall into many possible types. Based on the type of data, certain opera

Waving two numbers into each other, I have to weave two positive integers t...

I have to weave two positive integers together. For example, if the numbers are 137 and 064, the output integer would be 103647. This has to be done using integer arithmetic (not s

What is prototype, Prototype is having multiple instances or having clone.

Prototype is having multiple instances or having clone.

What is aop alliance, AOP Alliance is an open-source project whose goal is ...

AOP Alliance is an open-source project whose goal is to promote adoption of AOP and interoperability between different AOP implementations by describing a common set of interfaces

I have javascript work, I have JavaScript work Project Description: I...

I have JavaScript work Project Description: I need an annonation type tool added It should be incredible simple for a good js coder. But there will be a custom design and

What is bit-mapped or raster graphics, What is Bit-Mapped or Raster Graphic...

What is Bit-Mapped or Raster Graphics? Similar as object-oriented graphics, refers to software and hardware which use geometrical formulas to represent images. The other techni

Area of the curve, program t ofind area under the curve y=f(x) between x=a ...

program t ofind area under the curve y=f(x) between x=a and x=b integrate y=f(x) between the limits a and b

Prepare simple spring maven task, Prepare Simple spring maven task Proje...

Prepare Simple spring maven task Project Description: We want a very simple delivery for one of our tasks using Spring STS Maven project. This chat does not have UI interf

Java web programming, Write a JSP to display a table that contains factoria...

Write a JSP to display a table that contains factorials for the numbers from 0 to 10,

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