Program to use control loops in Applets

Here, we have shown four circle one below other using "for" loop with two different colors. The methods used are drawOval( )fillOval( ) and setColor( ). Details of these methods are given in previous programs.


PROGRAM
import java.awt.*;
import java.applet.*;

public class ControlLoopApplet extends Applet
{
 public void paint(Graphics g)
 {
  
  
  
  for(int i=1;i<=4;i++)
  {
   if(i%2==0)
   {
    g.fillOval(90,i*50+10,50,50);
    g.setColor(Color.black);
   }
   else
   {
    g.drawOval(90,i*50+10,50,50);
    g.setColor(Color.red);
   }
  }
 }
}
/* <applet code=ControlLoopApplet width=300 height=300>
  </applet> */

OUTPUT

C:\>javac ControlLoopApplet.java
C:\>appletviewer ControlLoopApplet.java



Comments

  1. I like your post very much. It is very useful for my research. I hope you can share more info about this. Keep posting Mulesoft Developer Certification
    servicenow developer Certification
    Workday training
    Workday financial training
    Workday HCM Online training

    ReplyDelete
  2. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website Workday HCM Online Training
    best Workday HCM Online Training
    top Workday HCM Online Training

    ReplyDelete
  3. Thanks for Sharing This Article.It is very so much valuable content. I hope these Commenting lists will help to my website sap lumira online training
    best sap lumira online training
    top sap lumira online training

    ReplyDelete
  4. Wow, amazing block structure! How long
    Have you written a blog before? Working on a blog seems easy.
    The overview of your website is pretty good, not to mention what it does.
    In the content!
    Loop Email Crack
    Kontakt Crack
    Plex Media Server Crack
    ManicTime Pro Crack
    Samepage Crack

    ReplyDelete
  5. Wow, amazing block structure! How long
    Have you written a blog before? Working on a blog seems easy.
    The overview of your website is pretty good, not to mention what it does.
    In the content!
    Loop Email Crack
    Kontakt Crack
    Plex Media Server Crack
    ManicTime Pro Crack
    Samepage Crack

    ReplyDelete

Post a Comment

Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

Program to input age from user and throw user-defined exception if entered age is negative

Define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.