0% found this document useful (0 votes)
1K views2 pages

Practical3.1 //write A Program To Display The Number On Button From 0 To 9

This Java program creates an applet with a grid layout of 5 rows and 2 columns to display 10 buttons numbered 0 through 9. It initializes a GridLayout with the specified dimensions, sets the applet layout, creates 10 Button objects assigning a number as text to each, and adds them to the applet in order using the GridLayout.

Uploaded by

rohitchavan2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views2 pages

Practical3.1 //write A Program To Display The Number On Button From 0 To 9

This Java program creates an applet with a grid layout of 5 rows and 2 columns to display 10 buttons numbered 0 through 9. It initializes a GridLayout with the specified dimensions, sets the applet layout, creates 10 Button objects assigning a number as text to each, and adds them to the applet in order using the GridLayout.

Uploaded by

rohitchavan2345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical3.

1
//Write a program to display the number on button from 0 to 9
import java.awt.*;
import java.applet.*;
public class GridLayout_Demo extends Applet
{
GridLayout g;
Button b0,b1,b2,b3,b4,b5,b6,b7,b8,b9;
public void init()
{

g=new GridLayout(5,2);
setLayout(g);
b0=new Button("0");
b1=new Button("1");
b2=new Button("2");
b3=new Button("3");
b4=new Button("4");
b5=new Button("5");
b6=new Button("6");
b7=new Button("7");
b8=new Button("8");
b9=new Button("9");
add(b0);
add(b1);
add(b2);
add(b3);
add(b4);
add(b5);
add(b6);
add(b7);
add(b8);
add(b9);

/*<appletcode="GridLayout_Demo.class"
width=300 height=300></applet>*/

You might also like