Ajp Exp 12
Ajp Exp 12
Experiment No : 12
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
JPasswordField j;
JTextField t1;
exp12_1() {
setTitle("MM");
t1 = new JTextField(10);
j = new JPasswordField(10);
b1 = new JButton("Login");
b2 = new JButton("Reset");
b1.addActionListener(this);
b2.addActionListener(this);
add(l1); add(t1);
add(l2); add(j);
add(b1); add(b2);
setVisible(true);
if (e.getSource() == b1) {
l3.setText("Valid Login");
t1.setText(" ");
j.setText(" ");
l3.setText(" ");
new exp12_1();}}
NAME : Mujahid Chaudhary
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
JPasswordField j;
JTextField t1;
exp12_2() {
setTitle("MM");
t1 = new JTextField(10);
j = new JPasswordField(10);
b1 = new JButton("Login");
b2 = new JButton("Reset");
b1.addActionListener(this);
b2.addActionListener(this);
add(l1);
add(t1);
add(l2);
add(j);
add(b1);
add(b2);
add(l3);
setSize(400, 400);
setVisible(true);
NAME : Mujahid Chaudhary
@SuppressWarnings("deprecation")
if (e.getSource() == b1) {
else
l3.setText("Valid Password");
t1.setText(" ");
j.setText(" ");
l3.setText(" ");
new exp12_2();}}
NAME : Mujahid Chaudhary
import javax.swing.*;
import java.awt.*;
JLabel l1;
JPasswordField pf1;
exp12_3()
setLayout(new FlowLayout());
pf1=new JPasswordField(10);
pf1.setEchoChar('#');
add(l1);
add(pf1);
setVisible(true);
setTitle("MM");
setSize(100,100);
NAME : Mujahid Chaudhary
new exp12_3();
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
JLabel l1,l2,l3;
JTextField t1,t2,t3;
JButton b1,b2;
exp12_4() {
setLayout(new GridLayout(4,2));
setTitle("MM");
t1=new JTextField(10);
t2=new JTextField(10);
t3=new JTextField(10);
b1=new JButton("Add");
NAME : Mujahid Chaudhary
b1.addActionListener(this);
b2=new JButton("Clear");
b2.addActionListener(this);
add(l1); add(t1);
add(l2);
add(t2);
add(l3);
add(t3);
add(b1);
add(b2);
setVisible(true);
setSize(100,100);
if (e.getSource()==b1) {
int c=Integer.parseInt(t1.getText());
int d=Integer.parseInt(t2.getText());
int a=c+d;
t3.setText(Integer.toString(a));
if (e.getSource()==b2) {
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");
new exp12_4();
}
NAME : Mujahid Chaudhary