Skip to content

Commit 9fb81f5

Browse files
authored
filling and setting color using applet
1 parent 0e946ad commit 9fb81f5

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Graphics/Color/ColorDemo.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//print hello world in red color and gces in green and create red and green rectangle using applet
2+
import java.awt.*;
3+
import java.applet.Applet;
4+
5+
/* <applet code = "ColorDemo" height = "300" width = "300"></applet> */
6+
7+
public class ColorDemo extends Applet {
8+
public void paint(Graphics g) {
9+
g.setColor(new Color(255, 0, 0));
10+
g.fillRect(60, 60, 40, 40);
11+
g.drawString("Hello World", 40, 40);
12+
g.setColor(new Color(0, 255, 0));
13+
g.fillRect(90, 60, 40, 40);
14+
g.drawString("GCES", 40, 80);
15+
16+
}
17+
}

0 commit comments

Comments
 (0)