0% found this document useful (0 votes)
25 views5 pages

1.execute The Following Program and Write Output

Uploaded by

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

1.execute The Following Program and Write Output

Uploaded by

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

X.

Program Code:
1.Execute the following program and write output
OUTPUT:
XIII. Exercise
1.Write Java Program to display following output.
CODE:
package Experiment4;

import java.applet.Applet;
import java.awt.*;

public class Exercise1 extends Applet {


Button b1 = new Button("Button One");
Button b2 = new Button("Button Two");
Button b3 = new Button("Button Three");
Button b4 = new Button("Button Four");
Button b5 = new Button("Button Five");
@Override
public void init() {
GridBagConstraints gbc = new GridBagConstraints();
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 0;
gbc.gridy = 0;
add(new Button("Button One"), gbc);
gbc.gridx = 1;
gbc.gridy = 0;
add(new Button("Button two"), gbc);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.ipady = 20;
gbc.gridx = 0;
gbc.gridy = 1;
add(new Button("Button Three"), gbc);
gbc.gridx = 1;
gbc.gridy = 1;
add(new Button("Button Four"), gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 2;
add(new Button("Button Five"), gbc);
add(new Label("By Soham Parab 19"));
setSize(300, 300);
setVisible(true);
}
}
OUTPUT
2.Write Java Program to display output.
CODE:
package Experiment4;

import java.applet.Applet;
import java.awt.*;

public class Exercise2 extends Applet {


Label l1 = new Label("Name");;
Label l2 = new Label("Comments");
TextField t1 = new TextField();
TextArea t2 = new TextArea(5,5);
Button b1 = new Button("Submit");
@Override
public void init() {
GridBagConstraints gbc = new GridBagConstraints();
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 0;
gbc.gridy = 0;
add(l1,gbc);

gbc.gridx = 1;
gbc.gridy = 0;
add(t1,gbc);

gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 0;
gbc.gridy = 1;
add(l2,gbc);

gbc.gridx = 1;
gbc.gridy = 1;
add(t2,gbc);

gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridx = 1;
gbc.gridy = 2;
add(b1,gbc);
add(new Label("By Soham Parab 19"));
}
}
OUTPUT

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