diff --git a/part-1/.idea/.gitignore b/part-1/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/part-1/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/part-1/.idea/misc.xml b/part-1/.idea/misc.xml
new file mode 100644
index 0000000..e133e2a
--- /dev/null
+++ b/part-1/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/part-1/.idea/modules.xml b/part-1/.idea/modules.xml
new file mode 100644
index 0000000..ddf6c41
--- /dev/null
+++ b/part-1/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/part-1/.idea/part-1.iml b/part-1/.idea/part-1.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/part-1/.idea/part-1.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/part-1/.idea/vcs.xml b/part-1/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/part-1/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/part-1/E1.class b/part-1/E1.class
new file mode 100644
index 0000000..0038c2e
Binary files /dev/null and b/part-1/E1.class differ
diff --git a/part-1/E1.java b/part-1/E1.java
index e69de29..48b0946 100644
--- a/part-1/E1.java
+++ b/part-1/E1.java
@@ -0,0 +1,38 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class E1 extends JFrame implements ActionListener {
+ JButton button;
+ JLabel label;
+ private int clickCount = 0;
+
+ public E1() {
+ button = new JButton("Click Me");
+ button.setPreferredSize(new Dimension(200, 50));
+ label = new JLabel("Clicks: 0", SwingConstants.CENTER);
+
+ button.addActionListener(this);
+
+ this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+ this.setLayout(new BorderLayout());
+ this.setTitle("Click Counter");
+ this.setSize(400, 400);
+ this.getContentPane().setBackground(new Color(255, 182, 193));
+ this.add(button, BorderLayout.SOUTH);
+ this.add(label, BorderLayout.CENTER);
+ this.setVisible(true);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (e.getSource() == button) {
+ clickCount++;
+ label.setText("Clicks: " + clickCount);
+ }
+ }
+ public static void main(String[] args) {
+ new E1();
+ }
+}
diff --git a/part-2/E2.class b/part-2/E2.class
new file mode 100644
index 0000000..3602951
Binary files /dev/null and b/part-2/E2.class differ
diff --git a/part-2/E2.java b/part-2/E2.java
index e69de29..20f67ad 100644
--- a/part-2/E2.java
+++ b/part-2/E2.java
@@ -0,0 +1,48 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class E2 extends JFrame implements ActionListener {
+ private JButton button;
+ private JLabel label;
+ private JTextField textField;
+
+ public E2() {
+ button = new JButton("Greet");
+ button.setPreferredSize(new Dimension(100, 20));
+ button.addActionListener(this);
+
+ label = new JLabel("Enter your name and press Greet", SwingConstants.CENTER);
+ textField = new JTextField(20);
+
+ JPanel inputPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 10, 10));
+ inputPanel.add(new JLabel("Name:"));
+ inputPanel.add(textField);
+ inputPanel.add(button);
+
+ JPanel mainPanel = new JPanel(new BorderLayout(10, 10));
+ mainPanel.add(label, BorderLayout.SOUTH);
+ mainPanel.add(inputPanel, BorderLayout.CENTER);
+
+ this.setTitle("Greeting Form");
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ this.setSize(400, 200);
+ this.add(mainPanel);
+ this.setVisible(true);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String name = textField.getText().trim();
+ if (name.isEmpty()) {
+ label.setText("Please enter a name.");
+ } else {
+ label.setText("Hello, " + name + "!");
+ }
+ }
+
+ public static void main(String[] args) {
+ new E2();
+ }
+}
diff --git a/part-3/E3.class b/part-3/E3.class
new file mode 100644
index 0000000..d41746a
Binary files /dev/null and b/part-3/E3.class differ
diff --git a/part-3/E3.java b/part-3/E3.java
index e69de29..efb7e1b 100644
--- a/part-3/E3.java
+++ b/part-3/E3.java
@@ -0,0 +1,62 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class E3 extends JFrame implements ActionListener {
+ private JPanel mainPanel;
+ private JButton redButton;
+ private JButton greenButton;
+ private JButton blueButton;
+
+ public E3() {
+
+ mainPanel = new JPanel();
+
+ redButton = new JButton("Red");
+ greenButton = new JButton("Green");
+ blueButton = new JButton("Blue");
+
+ redButton.setActionCommand("RED");
+ greenButton.setActionCommand("GREEN");
+ blueButton.setActionCommand("BLUE");
+
+ redButton.addActionListener(this);
+ greenButton.addActionListener(this);
+ blueButton.addActionListener(this);
+
+ JPanel buttonPanel = new JPanel();
+ buttonPanel.add(redButton);
+ buttonPanel.add(greenButton);
+ buttonPanel.add(blueButton);
+
+ setLayout(new BorderLayout());
+ add(buttonPanel, BorderLayout.NORTH);
+ add(mainPanel, BorderLayout.CENTER);
+
+ this.setTitle("Theme Color Selector");
+ this.setSize(400, 300);
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ this.setLocationRelativeTo(null);
+ this.setVisible(true);
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ switch (e.getActionCommand()) {
+ case "RED":
+ mainPanel.setBackground(Color.RED);
+ break;
+ case "GREEN":
+ mainPanel.setBackground(Color.GREEN);
+ break;
+ case "BLUE":
+ mainPanel.setBackground(Color.BLUE);
+ break;
+ }
+ }
+ public static void main(String[] args) {
+ new E3();
+ }
+}
diff --git a/part-4/E4.class b/part-4/E4.class
new file mode 100644
index 0000000..57cf94f
Binary files /dev/null and b/part-4/E4.class differ
diff --git a/part-4/E4.java b/part-4/E4.java
index e69de29..e015540 100644
--- a/part-4/E4.java
+++ b/part-4/E4.java
@@ -0,0 +1,103 @@
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class E4 extends JFrame implements ActionListener {
+ private JTextField txtName;
+ private JTextField txtEmail;
+ private JPasswordField txtPassword;
+ private JRadioButton rbMale, rbFemale;
+ private JCheckBox cbJava, cbPython, cbCpp;
+ private JButton btnSubmit;
+ private GridBagConstraints gbc;
+
+ public E4() {
+ JPanel panel = new JPanel(new GridBagLayout());
+ gbc = new GridBagConstraints();
+ gbc.insets = new Insets(5, 5, 5, 5);
+ gbc.fill = GridBagConstraints.HORIZONTAL;
+
+ gbc.gridx = 0; gbc.gridy = 0;
+ panel.add(new JLabel("Name:"), gbc);
+ gbc.gridx = 1;
+ txtName = new JTextField(20);
+ panel.add(txtName, gbc);
+
+ gbc.gridx = 0; gbc.gridy = 1;
+ panel.add(new JLabel("Email:"), gbc);
+ gbc.gridx = 1;
+ txtEmail = new JTextField(20);
+ panel.add(txtEmail, gbc);
+
+ gbc.gridx = 0; gbc.gridy = 2;
+ panel.add(new JLabel("Password:"), gbc);
+ gbc.gridx = 1;
+ txtPassword = new JPasswordField(20);
+ panel.add(txtPassword, gbc);
+
+ gbc.gridx = 0; gbc.gridy = 3;
+ panel.add(new JLabel("Gender:"), gbc);
+ gbc.gridx = 1;
+ rbMale = new JRadioButton("Male");
+ rbFemale = new JRadioButton("Female");
+ ButtonGroup genderGroup = new ButtonGroup();
+ genderGroup.add(rbMale);
+ genderGroup.add(rbFemale);
+ JPanel genderPanel = new JPanel();
+ genderPanel.add(rbMale);
+ genderPanel.add(rbFemale);
+ panel.add(genderPanel, gbc);
+
+ gbc.gridx = 0; gbc.gridy = 4;
+ panel.add(new JLabel("Interests:"), gbc);
+ gbc.gridx = 1;
+ cbJava = new JCheckBox("Java");
+ cbPython = new JCheckBox("Python");
+ cbCpp = new JCheckBox("C++");
+ JPanel interestPanel = new JPanel();
+ interestPanel.add(cbJava);
+ interestPanel.add(cbPython);
+ interestPanel.add(cbCpp);
+ panel.add(interestPanel, gbc);
+
+ gbc.gridx = 1; gbc.gridy = 5;
+ gbc.anchor = GridBagConstraints.CENTER;
+ btnSubmit = new JButton("Submit");
+ btnSubmit.addActionListener(this);
+ panel.add(btnSubmit, gbc);
+
+ add(panel);
+
+ this.setTitle("User Registration");
+ this.setSize(500, 350);
+ this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+ this.setLocationRelativeTo(null);
+ this.setVisible(true);
+
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ String name = txtName.getText();
+ String email = txtEmail.getText();
+ String gender = rbMale.isSelected() ? "Male" :
+ rbFemale.isSelected() ? "Female" : "Unspecified";
+ StringBuilder interests = new StringBuilder();
+ if (cbJava.isSelected()) interests.append("Java ");
+ if (cbPython.isSelected()) interests.append("Python ");
+ if (cbCpp.isSelected()) interests.append("C++ ");
+
+ JOptionPane.showMessageDialog(this,
+ "Name: " + name + "\n" +
+ "Email: " + email + "\n" +
+ "Gender: " + gender + "\n" +
+ "Interests: " + interests.toString().trim(),
+ "Registration Details",
+ JOptionPane.INFORMATION_MESSAGE
+ );
+ }
+ public static void main(String[] args) {
+ new E4();
+ }
+}