Practical No 1 2
Practical No 1 2
import java.awt.*;
import javax.swing.*;
public class Prashant
{
public static void main(String[] args)
{
JFrame frame = new JFrame("All components");
frame.setSize(400, 300);
frame.setLayout(new FlowLayout());
JLabel label = new JLabel(":");
frame.add(label);
JTextField textField = new JTextField(20);
frame.add(textField);
JTextArea textArea = new JTextArea(5, 20);
frame.add(textArea);
JButton button = new JButton("daba yaha");
frame.add(button);
JCheckBox checkBox = new JCheckBox("chetan");
frame.add(checkBox);
JCheckBox checkBox1 = new JCheckBox("Prasad");
frame.add(checkBox1);
JCheckBox checkBox2 = new JCheckBox("adish");
frame.add(checkBox2);
JCheckBox checkBox3 = new JCheckBox("ujval");
frame.add(checkBox3);
frame.setVisible(true);
}
}
********************************************************************************
Output :
Practical No : 2
# Write a program to design a form using the components List and choice.
import java.awt.*;
import javax.swing.*;
public class Prashant {
public static void main(String[] args) {
JFrame frame = new JFrame("List and Choice");
frame.setSize(400, 200);
frame.setLayout(null);
List l1 = new List();
l1.add("mit");
l1.add("sandip");
l1.add("kkw");
l1.add("met");
frame.add(l1);
l1.setBounds(0,45,350,30);
Choice ch = new Choice();
ch.add("Computer");
ch.add("Electrical");
ch.add("Mechanical");
ch.add("Civil");
ch.setBounds(10,180,350,50);
frame.add(ch);
frame.setVisible(true);
}}
**********************************************************************************
Output :