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

Difference between a scrollbar and a scrollpanel in jsp, A Scrollbar is a C...

A Scrollbar is a Component while Scroll Panel is a Container. A Scroll Panel handles its own events and performs its own scrolling.

Prepare a small android application, Android App Project Description: ...

Android App Project Description: I am seeking an experienced individual to prepare a small android application The only difference is that I would like movement to be done

Applet program, file download from server using applet and tomcat server

file download from server using applet and tomcat server

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?

Binary search tree, You will be required to create an ADT for a Binary Sear...

You will be required to create an ADT for a Binary Search Tree (BSTInterface.java). The interface will be implemented as a Binary Search Tree (BST) using a reference based format.

Minimumself, At a shop of marbles, packs of marbles are prepared. Packets a...

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Explain exception classes, OOPS with Java 1. Explain any five buzz word...

OOPS with Java 1. Explain any five buzz words in Java. 2. Explain exception classes and also explain common exceptions in java. 3. Explain primitive and abstract data typ

The software or script to scan automotive ads, The software or script to sc...

The software or script to scan automotive ads Project Description: Looking for a company that made the script or application to search through pages of listings of automotive

Assignments, Define a function that will take a box type of object as argum...

Define a function that will take a box type of object as argument and return a box object whose dimension is 10 times more than the object

Programming Excercise, I have to Create a program that determine the shippi...

I have to Create a program that determine the shipping cost for an order based on he following chart: From To Price $0.00 $19.99 $2.95 $20.00 $49.99 $3.95

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