Java Programs[Important]
- WRITE A JAVA
PROGRAM that allows user to draw lines, rectangles and ovals.
 
-  
 
- Program : import   x.swing.*; import   .awt.Graphics;
 
-  
 
- public class
choice extends JApplet
 
-  { 
 
- int i,ch; public void init()
 
-  { 
 
- String input; 
 
- input=JOptionPane.showInputDialog("enter
choice(1-lines,2-rectangles,3-ovals)"); 
 
- ch=Integer.parseInt(input);
 
-  } 
 
- public void paint(Graphics g) 
 
- { 
 
- switch(ch) 
 
- { 
 
 
- case 1:
 
- { 
 
- your
 
 
- for(i=1;i<=10;i++) 
 
- { 
 
- g.drawLine(10,10,250,10*i); 
 
- } 
 
- break; 
 
- }
 
-  
 
- case 2:{
 
-  for(i=1;i<=10;i++) 
 
- { 
 
- g.drawRect(10*i,10*i,50+10*i,50+10*i);
 
-  }
 
-  break; 
 
- }
 
-  
 
- case 3:
 
- { 
 
- for(i=1;i<=10;i++) 
 
- { 
 
- g.drawOval(10*i,10*i,50+10*i,50+10*i);
 
-  } 
 
- break; 
 
- }
 
- }
 
- }
 
- }