0% found this document useful (0 votes)
10 views3 pages

Manual Page No 4 All Questions 1

Uploaded by

sayedshaad02
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)
10 views3 pages

Manual Page No 4 All Questions 1

Uploaded by

sayedshaad02
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/ 3

MANUAL PAGE NO 4 ALL QUESTIONS

Q1

import java.awt.*;

class exp1_1 extends Frame {

exp1_1() {

// Creating a label
Label l1 = new Label("Welcome to Java");

// Using BorderLayout as the layout manager


setLayout(new BorderLayout());

// Adding the label to the center of the frame


add(l1, BorderLayout.CENTER);

// Setting the size of the frame


setSize(500, 500);

// Setting the frame to be visible


setVisible(true);
}

public static void main(String[] args) {


new exp1_1();
}
}

Q2

import java.awt.*;

class exp1_2 extends Frame {


exp1_2() {
// Set the title of the frame
super("Language Selection");

// Set the layout to null


setLayout(null);

// Create and position the label


Label l1 = new Label("Select known languages");
l1.setBounds(100, 50, 200, 30); // Adjusted bounds for better placement
add(l1);

// Create and position the checkboxes


Checkbox c1 = new Checkbox("Marathi");
c1.setBounds(100, 100, 100, 30); // Adjusted bounds for better
placement
add(c1);

Checkbox c2 = new Checkbox("Hindi");


c2.setBounds(100, 140, 100, 30); // Adjusted bounds for better
placement
add(c2);

Checkbox c3 = new Checkbox("English");


c3.setBounds(100, 180, 100, 30); // Adjusted bounds for better
placement
add(c3);

Checkbox c4 = new Checkbox("Sanskrit");


c4.setBounds(100, 220, 100, 30); // Adjusted bounds for better
placement
add(c4);

// Set the size of the frame


setSize(400, 400); // Adjusted size for better layout

// Make the frame visible


setVisible(true);
}

public static void main(String[] args) {


// Create an instance of the frame
new exp1_2();
}
}

Q3)

import java.awt.*;

class exp1_3 extends Frame {

exp1_3() {
// Setting the layout manager to FlowLayout
setLayout(new FlowLayout());

// Creating buttons
Button b1 = new Button("Ok");
Button b2 = new Button("Reset");
Button b3 = new Button("Cancel");

// Adding buttons to the frame


add(b1);
add(b2);
add(b3);

// Setting the size of the frame


setSize(500, 500);

// Setting the frame to be visible


setVisible(true);
}

public static void main(String[] args) {


new exp1_3();
}
}

You might also like