0% found this document useful (0 votes)
43 views4 pages

AJP Exp 3

The document discusses default layout managers and their properties. It provides the default layout for containers as FlowLayout. It lists the 5 regions of the BorderLayout as North, South, East, West, and Center. It explains that a frame's insets include a top inset for the title bar and borders, and any component can have its own insets. It states the default horizontal and vertical gap in FlowLayout is 5 units. It also includes a program to design a basic calculator applet using GridLayout.

Uploaded by

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

AJP Exp 3

The document discusses default layout managers and their properties. It provides the default layout for containers as FlowLayout. It lists the 5 regions of the BorderLayout as North, South, East, West, and Center. It explains that a frame's insets include a top inset for the title bar and borders, and any component can have its own insets. It states the default horizontal and vertical gap in FlowLayout is 5 units. It also includes a program to design a basic calculator applet using GridLayout.

Uploaded by

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

Exp-3

Q.1) Give name of default Layout for Different Container.

Ans. FlowLayout

Q.2) List names of BorderLayout regions.

Ans. 1) North

2) South

3)East

4)West

5)Center

Q.3) Write use of Insets in BorderLayout.

Ans.A frame's insets include a top inset that compensates for the frame's titlebar,
and insets all around that compensate for the border (which we can use to resize
the frame). A panel contained within a frame has its own insets. Indeed, any
component has its own insets.

Q.4) Write the default horizontal and vertical gap in FlowLayout.


Ans: 5Unit
Program:

Program to design simple calculator with use of gridLayout.

import java.awt.*;

import java.applet.*;

public class calculator extends Applet

public void init()

setFont(new Font("Monospaced",Font.BOLD,25));

GridLayout g=new GridLayout(6,3);

setLayout(g);

for(int i=1;i<=9;i++)

add(new Button(""+i));

Button b1=new Button("+");

Button b2=new Button("0");

Button b3=new Button("-");

Button b4=new Button("*");

Button b5=new Button("%");

Button b6=new Button("/");

Button b7=new Button("=");


TextField t=new TextField("Result");

add(b1);

add(b2);

add(b3);

add(b4);

add(b5);

add(b6);

add(b7);

add(t);

/*<applet code="calculator"width="600"height="600">

</applet>*/
Output:

You might also like