AJPPR3

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

import java.awt.

*;

public class Pr1

public static void main( String args[] )

Frame f = new Frame();

f.setVisible(true);

f.setSize(400,400);

f.setLayout(new GridLayout(2,2));

Font font = new Font("TimesRoman",Font.BOLD,25);

f.setFont(font);

Label l[] = new Label[25];

for(int i = 0 ; i < 25 ; i++)

String s = "";

s = s.valueOf(i+1);

Color c = new Color(i,i+10,i+20);

l[i] = new Label();

System.out.println(c);

l[i].setBackground(c);

l[i].setText(s);

for(int i = 0 ; i < 25;i++)

f.add(l[i]);

}
import java.awt.*;
public class Pr1

public static void main( String args[] )

Frame f = new Frame();

f.setVisible(true);

f.setSize(400,400);

f.setLayout(new GridLayout(2,2));

Button l[] = new Button[10];

for(int i = 0 ; i < 10; i++)

String s = "";

s = s.valueOf(i);

l[i] = new Button();

l[i].setLabel(s);

for(int i = 0 ; i < 25;i++)

f.add(l[i]);

}
import java.awt.*;

public class Pr1 extends Frame

private Button btnNorth, btnSouth, btnCenter, btnWest, btnEast;

Pr1()

Frame f = new Frame("GridLayoutDemo");

f.setVisible(true);

f.setSize(400,450);

f.setLayout(new BorderLayout(3 , 3));

btnNorth = new Button("NORTH");

f.add(btnNorth, BorderLayout.NORTH);

btnEast = new Button("EAST");

f.add(btnEast, BorderLayout.EAST);

btnCenter= new Button("CENTER");

f.add(btnCenter, BorderLayout.CENTER);
btnWest = new Button("WEST");

f.add(btnWest, BorderLayout.WEST);

btnSouth = new Button("SOUTH");

f.add(btnSouth, BorderLayout.SOUTH);

public static void main( String args[] )

Pr1 p = new Pr1();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy