import java.applet.*;
import java.awt.*;
public class Demo1 extends Applet
{
public void init()
{
//Code to run automatically
this.setSize(500, 500);
this.setBackground(Color.CYAN);
}
public void paint(Graphics g)
{
//now draw graphics
g.drawLine(0, 0, 100, 100);
g.drawRect(0, 0, 100, 100);
//change color of graphics
g.setColor(Color.blue);
g.drawString("Applet Demo", 0, 120);
}
}
By Gurpreet Singh, Department of Computer Science & Engineering, Amritsar College of Engineering & Technology
Tuesday, 4 August 2015
Applet Demo 1
Labels:
applet,
Core Java,
Graphics,
GUI Programming,
Java,
Java Programming,
Java8,
Learn Java,
paint
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment