You are on page 1of 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