Java-Repeated Execution of Start and Paint

Repeated Execution of Start and Paint The init() method to be executed only once. But the start() method called every time whenever the execution of an applet is to be resumed. Program Prorgam Source import java.applet.Applet; import java.awt.Graphics; public class Javaapp extends Applet { String str = “”; public void init() { str+=”-init-“; } public void … Read more…

Java-Repeated Execution of Paint

Repeated Execution of Paint The paint( ) method is automatically called by the appletviewer or the web browser whenever the applet needs to be refreshed. The paint method is called each time of your applet’s must be redrawn. For example the applet window is minimized and then maximized, paint( ) is also called when the … Read more…

5

Java-Arcs

Arcs An arc is a part of an oval. In fact, we can think of an oval as a series of arcs that are connected together in an orderly manner. The drawArc( ) designed to draw arcs takes six arguments. The first four are the same as the arguments for drawOval( ) method and the … Read more…

Java-Circle and Color

Circle The Graphics class does not have any method for circles or ellipses. However, the drawOval( ) method can be used to draw a circle or an ellipse. Ovals are just like rectangles with overly rounded corners. The drawOval( ) method takes four arguments, the first two represent the top left corner of the oval … Read more…

Java-Rectangles

drawRect We can draw a rectangle using the drawRect( ) method. This method takes four arguments. The first two represent the x and y coordinates of the top left corner of the rectangle, and the remaining two represent the width and the height of the rectangle. fillRect We can draw a solid box by using … Read more…