Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.applet.*;
- public class Lab05 extends Applet
- {
- public void paint(Graphics g)
- {
- int width = 980;
- int height = 630;
- int x1 = 10;
- int y1 = 640;
- int x2 = 990;
- int y2 = 640;
- g.drawRect(10,10,width,height);
- // hmm
- for
- (int W = 0; W <= 50; W++)
- {
- g.drawLine(x1,y1,x2,y2);
- x1= x1 + width/50;
- y2= y2 - height/50;
- }
- for
- (int W = 0; W <= 50; W++)
- {
- g.drawLine(x2, y2, x1, y1);
- x2 = x2 - width/50;
- y1 = y1 - height/50;
- }
- int nx1 = 10;
- int ny1 = 10;
- int nx2 = 990;
- int ny2 = 10;
- for
- (int W = 0; W <= 50; W++)
- {
- g.drawLine(nx1, ny1, nx2, ny2);
- nx2 = nx2 - width/50;
- ny1 = ny1 + height/50;
- }
- for
- (int W = 0; W <= 50; W++)
- {
- g.drawLine(nx2, ny2, nx1, ny1);
- nx1 = nx1 + width/50;
- ny2 = ny2 + height/50;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement