Java applet program that allows the user to draw lines, rectangles and ovals

Sunday, October 4th, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.awt.*;
import java.applet.*;
/*
<applet code="Sujith" width=200 height=200>
</applet>
*/
public class Sujith extends Applet
{
	public void paint(Graphics g)
	{
		for(int i=0;i<=250;i++)
		{
			Color c1=new Color(35-i,55-i,110-i);
			g.setColor(c1);
			g.drawRect(250+i,250+i,100+i,100+i);
			g.drawOval(100+i,100+i,50+i,50+i);
			g.drawLine(50+i,20+i,10+i,10+i);
		}
	}
}

Output:

Java applet progrme for draw lines, circle, rectangle

Java applet progrme for draw lines, circle, rectangle

Avatar of Ranjith

Author Name :
Ranjith

Total : 14 Comments


14 Responses to “Java applet program that allows the user to draw lines, rectangles and ovals”

  1. pradeep says:

    thanq

  2. abhijeet says:

    sir tell me about java applet, how to run applet program and what we need run of java program.

  3. suraj says:

    I that your task i want to do like this can you guide me

  4. suraj says:

    I like that your task i want to do like this can you guide me

  5. deathgenerator says:

    first of all u need jdk i.e java development kit and then a program compiler try blue j its free and easy to use

  6. Samadhan says:

    I like so much your program……………

    pls guide me …..

  7. venkat says:

    Hi i like ur coding its very nice……i want to do like this sa can u help me through online

  8. aebi says:

    superb!!!!!!!!!!!

  9. ravi says:

    very nice and its helful for beinners.

  10. Hariharan.k says:

    I want deficault java pkg programs

  11. ashiq says:

    plz send me the applet program to draw a simple computer….

  12. nazma says:

    awesome!! thanku:)

  13. vipul says:

    type this in notepad and save it as ComboProg.java.

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

    public class ComboProg extends Applet
    {
    int x,y,h,w;
    public void paint(Graphics g)
    {
    g.drawRect(10,10,20,30);
    g.drawOval(30,50,100,200);
    g.drawLine(250,300,400,500);
    }
    }

    *********************************
    then type this in another notepad and saving it as ComboProg.html

    go to command promt and compile and run the program

    procedure
    for compiling type
    javac ComboProg.java
    for viewing the result
    appletviewer ComboProg.html

  14. Prashanth says:

    g.drawRect(10,10,20,30); in this command what is what?

Leave a Reply

Question and Answer
C/C++ Unix & Linux Wordpress
Source codes
C C++ Java

Free email signup

Email: