We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a91f3d9 commit 03a7d92Copy full SHA for 03a7d92
DrawRect.java
@@ -0,0 +1,24 @@
1
+// Draw a rectange using parameters passed via Applet
2
+
3
+import java.awt,*;
4
+import java.applet.*;
5
6
+/*<applet code = "DrawRect" width = 100, height = 100>
7
+ <param name = "x" value = "100">
8
+ <param name = "y" value = "100">
9
+ <param name = "width" value = "200">
10
+ <param name = "height" value = "300">
11
+</applet>*/
12
13
+public class DrawRect extends Applet{
14
+ int x1,y1,w,h;
15
+ public void init(){
16
+ x1 = Integer.parseInt(getParameter("x"));
17
+ y1 = Integer.parseInt(getParameter("y"));
18
+ w = Integer.parseInt(getParameter("width"));
19
+ h = Integer.parseInt(getParameter("height"));
20
+ }
21
+ public void paint(Graphics g){
22
+ g.drawRect(x1,y1,w,h);
23
24
+}
0 commit comments