Skip to content

Commit 2e7150d

Browse files
authored
Add files via upload
Signed-off-by: kalyani chaudhari <138003080+misskalyani@users.noreply.github.com>
1 parent c2d7158 commit 2e7150d

36 files changed

+1244
-0
lines changed

Applet1/Addition.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<applet code="Addition.class" width="500" height="400">
4+
</applet>
5+
</body>
6+
</html>

Applet1/Addition.java

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import java.applet.*;
2+
import java.awt.*;
3+
import java.awt.event.*;
4+
5+
public class Addition extends Applet implements ActionListener
6+
{
7+
Label l1,l2,l3;
8+
TextField t1,t2,t3;
9+
Button b1;
10+
public void init()
11+
{
12+
l1=new Label("Enter First No");
13+
l2=new Label("Enter Second No");
14+
l3=new Label("Display Result");
15+
t1=new TextField(10);
16+
t2=new TextField(10);
17+
t3=new TextField(10);
18+
b1=new Button("ADD");
19+
add(l1);add(t1);add(l2);add(t2);add(l3);add(t3);add(b1);
20+
b1.addActionListener(this);
21+
}
22+
public void actionPerformed(ActionEvent ae)
23+
{
24+
if(ae.getSource()==b1)
25+
{
26+
int a=Integer.parseInt(t1.getText());
27+
int b=Integer.parseInt(t1.getText());
28+
int c=a+b;
29+
}
30+
}
31+
}

Applet1/Car.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body>
3+
<applet code="Car" height="500" width="500">
4+
</applet>
5+
</body>
6+
</html>

Applet1/Car.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import java.awt.*;
2+
import java.awt.event.*;
3+
import javax.swing.*;
4+
import java.applet.*;
5+
public class Car extends Applet implements ActionListener
6+
{
7+
int i=0;
8+
Button b1,b2,b3;
9+
public void init()
10+
{
11+
setLayout(new FlowLayout());
12+
b1=new Button("Next");
13+
b2=new Button("Stop");
14+
b3=new Button("Back");
15+
add(b1);add(b2);add(b3);
16+
b1.addActionListener(this);
17+
b2.addActionListener(this);
18+
b3.addActionListener(this);
19+
20+
}
21+
public void paint(Graphics g)
22+
{
23+
24+
g.drawRect(100+i,100,200,100);
25+
g.setColor(Color.red);
26+
g.fillRect(100+i,100,200,100);
27+
g.setColor(Color.white);
28+
g.fillOval(100+i,10,10,10);
29+
30+
g.drawRect(300+i,105,20,90);
31+
g.setColor(Color.yellow);
32+
g.fillRect(300+i,105,40,90);
33+
34+
/*g.drawRect(200+i,100,50,50);
35+
g.setColor(Color.pink);
36+
g.fillRect(200+i,100,50,50);*/
37+
38+
g.setColor(Color.black);
39+
g.fillOval(120+i,200,30,30);
40+
g.setColor(Color.black);
41+
g.fillOval(150+i,200,30,30);
42+
g.setColor(Color.black);
43+
g.fillOval(200+i,200,30,30);
44+
g.setColor(Color.black);
45+
g.fillOval(200+i,200,30,30);
46+
g.setColor(Color.black);
47+
g.fillOval(230+i,200,30,30);
48+
49+
50+
}
51+
public void actionPerformed(ActionEvent ae)
52+
{
53+
if(ae.getSource()==b1)
54+
{
55+
for(i=0;i<=1000;i=i+(30))
56+
repaint();
57+
}
58+
if(ae.getSource()==b2)
59+
{
60+
stop();
61+
}
62+
if(ae.getSource()==b3)
63+
{
64+
for(i=0;i<=1000;i=i+(-30))
65+
66+
repaint();
67+
}
68+
}
69+
}

Applet1/Car2.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<applet code="Car2" width=1200 height=720></applet>
4+
</body>
5+
</html>

Applet1/Car2.java

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import java.applet.*;
2+
import java.awt.*;
3+
import java.awt.event.*;
4+
5+
public class Car2 extends Applet implements KeyListener
6+
{
7+
void slep()
8+
{
9+
try
10+
{
11+
Thread.sleep(100);
12+
}
13+
catch(Exception ex)
14+
{
15+
}
16+
}
17+
int x=600,y=360;
18+
public void paint(Graphics g)
19+
{
20+
21+
addKeyListener(this);
22+
setBackground(Color.gray);
23+
g.setColor(Color.black);
24+
g.drawOval(x-2,y+15,7,20);
25+
g.fillOval(x-2,y+15,7,20);
26+
g.drawOval(x-2,y+75,7,20);
27+
g.fillOval(x-2,y+75,7,20);
28+
g.setColor(Color.blue);
29+
g.drawRoundRect(x,y,76,105,10,20);
30+
g.fillRoundRect(x,y,76,105,10,20);
31+
g.setColor(Color.black);
32+
g.drawRect(x+7,y+75,62,18);
33+
g.fillRect(x+7,y+75,62,18);
34+
g.setColor(Color.red);
35+
g.drawOval(x+4,y+95,6,9);
36+
g.drawOval(x+66,y+95,6,9);
37+
g.fillOval( x+4,y+95,6,9);
38+
g.fillOval( x+66,y+95,6,9);
39+
g.setColor(Color.black);
40+
g.drawRoundRect(x+7,y+35,63,35,10,20);
41+
42+
g.setColor(Color.yellow);
43+
g.drawOval(x+4,y+1,9,15);
44+
g.drawOval(x+3,y+1,9,15);
45+
g.fillOval(x+63,y+1,9,15);
46+
g.fillOval(x+4,y+1,9,15);
47+
48+
slep();
49+
50+
}
51+
public void keyPressed(KeyEvent ke){
52+
int KeyCode = ke.getKeyCode();
53+
54+
switch(KeyCode)
55+
{
56+
case KeyEvent.VK_UP:
57+
if(y>0)
58+
y=y-1;
59+
break;
60+
case KeyEvent.VK_DOWN:
61+
if(y<getHeight()-105)
62+
y=y+1;
63+
break;
64+
case KeyEvent.VK_LEFT:
65+
if(x>0)
66+
x=x-1;
67+
break;
68+
case KeyEvent.VK_RIGHT:
69+
if(x<getWidth()-76)
70+
x++;
71+
break;
72+
}
73+
repaint();
74+
}
75+
76+
public void keyTyped(KeyEvent ke) {
77+
78+
}
79+
80+
public void keyReleased(KeyEvent ke){
81+
}
82+
83+
84+
85+
86+
}

Applet1/Car3.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import java.applet.*;
2+
import java.awt.*;
3+
4+
@SuppressWarnings("serial")
5+
public class CarAnimation extends Applet implements Runnable {
6+
private int x = 0;
7+
private int y = 150;
8+
private int speed = 5;
9+
private boolean isMoving = true;
10+
11+
public void init() {
12+
setBackground(Color.WHITE);
13+
}
14+
15+
public void start() {
16+
Thread thread = new Thread(this);
17+
thread.start();
18+
}
19+
20+
public void stop() {
21+
isMoving = false;
22+
}
23+
24+
public void paint(Graphics g) {
25+
g.setColor(Color.BLACK);
26+
g.fillRect(0, 200, getWidth(), 50); // Road
27+
g.setColor(Color.WHITE);
28+
int lineY = 225;
29+
for (int i = 0; i < getWidth(); i += 50) {
30+
g.fillRect(i, lineY, 30, 5); // Dashed lines
31+
}
32+
g.setColor(Color.RED);
33+
g.fillRect(x, y, 100, 50); // Car body
34+
g.setColor(Color.PURPLE);
35+
g.fillRect(x + 10, y - 40, 80, 50); // Car roof
36+
g.setColor(Color.BLUE);
37+
g.fillOval(x + 10, y + 40, 30, 30); // Left wheel
38+
g.fillOval(x + 60, y + 40, 30, 30); // Right wheel
39+
}
40+
41+
public void run() {
42+
while (isMoving) {
43+
x += speed;
44+
if (x > getWidth()) {
45+
x = -100; // Reset the car's position
46+
}
47+
repaint();
48+
try {
49+
Thread.sleep(50); /* Sleep for smooth animation */
50+
} catch (InterruptedException e) {
51+
e.printStackTrace();
52+
}
53+
}
54+
}
55+
}
56+

Applet1/Gdemo.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.awt.*;
2+
import java.applet.*;
3+
public class Gdemo extends Applet
4+
{
5+
public void paint(Graphics g)
6+
{
7+
g.drawString("Welcome Kalyani...!",150,10);
8+
9+
10+
g.drawLine(10,20,300,500);
11+
g.drawRect(100,50,100,300);
12+
g.fillRect(250,50,100,300);
13+
g.drawRoundRect(400,50,100,300,50,50);
14+
g.drawOval(100,400,100,100);
15+
g.setColor(Color.pink);
16+
g.fillArc(300,300,100,100,200,200);
17+
g.setColor(Color.red);
18+
int a[]={100,550,300,600,50};
19+
int b[]={100,150,200,300,500};
20+
g.drawPolygon(a,b,5);
21+
}
22+
}
23+
/*<applet code="Gdemo" height="500" width="500">
24+
</applet>*/

Applet1/GraphicsDemo.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<html>
2+
<body bgcolor="red" >
3+
<applet code="GraphicsDemo" width="500" height="400">
4+
</applet>
5+
</body>
6+
</html>

Applet1/GraphicsDemo.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
import java.applet.*;
3+
import java.awt.*;
4+
public class GraphicsDemo extends Applet
5+
{
6+
public void paint(Graphics g)
7+
{
8+
Font f1=new Font("Arial",Font.BOLD,25);
9+
g.setFont(f1);
10+
g.drawString("Welcome Kalyani",100,100);
11+
g.drawRect(100,100,200,50);//x y width height
12+
g.drawOval(100,200,100,150);//x y w h
13+
g.drawLine(100,200,300,300);//x1 y1 x2 y2
14+
g.setColor(Color.red);
15+
g.fillOval(300,200,100,100);
16+
g.setColor(Color.pink);
17+
g.fillRect(100,300,200,50);
18+
g.drawArc(100,100,200,200,90,360);
19+
}
20+
}
21+
22+

Applet1/Jtable.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.awt.*;
2+
import javax.swing.*;
3+
class table extends JFrame
4+
{
5+
JTable tbl;
6+
table()
7+
{
8+
setVisible(true);
9+
setSize(500,500);
10+
setLayout(new FlowLayout());
11+
String head[]={"ENO","NAME","SALARY"};
12+
String data[][]={{"101","sai","60000"},
13+
{"102","ram","78000"},
14+
{"103","om","67000"}};
15+
tbl=new JTable(data , head);
16+
// add(tbl);
17+
JScrollPane js=new JScrollPane(tbl);
18+
add(js);
19+
}
20+
public static void main(String ar[])
21+
{
22+
new table();
23+
}
24+
}

Applet1/car1.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Simple Car Applet</title>
5+
</head>
6+
<body>
7+
<applet code="car1.class" width="300" height="200">
8+
Your browser does not support Java applets.
9+
</applet>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)