0% found this document useful (0 votes)
7 views2 pages

Experiment No

Uploaded by

techinsighthub12
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)
7 views2 pages

Experiment No

Uploaded by

techinsighthub12
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/ 2

Experiment No : 11

Name : Samiksha Suhas


Patil. Roll_No: 150
Batch:S6

1. Problem Statement : Demonstration of GridLayout

1 2
1 2 3
3 4
4 5 6
5 6
Before Clicking
After Clicking

import javax.swing.*;
import java.awt.*;

public class GridLayoutDemo extends JFrame {

private JPanel panel;


private boolean isOriginalLayout = true;

public GridLayoutDemo() {
setTitle("GridLayout Demo");
setSize(300, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);

panel = new JPanel(new GridLayout(2, 3));

for (int i = 1; i <= 6; i++) {


JButton button = new JButton(String.valueOf(i));
button.addActionListener(e -> {

if (isOriginalLayout) {
panel.setLayout(new GridLayout(3, 2));
} else {
panel.setLayout(new GridLayout(2, 3));
}
isOriginalLayout = !isOriginalLayout;

panel.revalidate();
});
panel.add(button);
}

add(panel);
setVisible(true);
}

public static void main(String[] args) {


new GridLayoutDemo();
}
}

2. Problem Statement : Write GUI program to find factorial of given


number using applet.

Output:

Conclusion:

A source generates an event and sends it to one or more


listeners.

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