Java Applet Program to divide screen in horizontally in 3 equal parts and fill it with different colors.
Simple Applet Program to divide screen in horizontally in 3 equal parts and fill it with different colors.
Code:
package aj.pkg1;
import java.applet.*;
import java.awt.*;
public class AJ1
{
AJ1()
{
Frame f= new Frame("Panel");
Panel p1=new Panel();
Panel p2=new Panel();
Panel p3=new Panel();
p1.setBounds(0,0,400,150);
p1.setBackground(Color.orange);
p2.setBounds(0,150,400,140);
p2.setBackground(Color.white);
p3.setBounds(0,290,400,150);
p3.setBackground(Color.green);
f.add(p1);
f.add(p2);
f.add(p3);
f.setSize(400,400);
f.setLayout(null);
f.setVisible(true);
}
public static void main(String[] args)
{
new AJ1();
}}
Comments
Post a Comment