AJP Pract-11 - Merged
AJP Pract-11 - Merged
AJP Pract-11 - Merged
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
addMouseMotionListener(this);
setBackground(Color.red);
repaint();
setBackground(Color.green);
repaint();
/*
</applet>
*/
Output:
Code-2:
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
int count = 0;
addMouseListener(this);
}
public void mouseClicked(MouseEvent me)
count++;
repaint();
/*
</applet>
*/
Output:
Code-3:
import java.awt.*;
import java.awt.event.*;
Label l;
MouseListenerEx()
addMouseListener(this);
l=new Label();
l.setBounds(20,50,100,200);
add(l);
setSize(300,300);
setLayout(null);
setVisible(true);
l.setText("Mouse Clicked");
l.setText("Mouse Entered");
l.setText("Mouse Exited");
l.setText("Mouse Pressed");
l.setText("Mouse Released");
new MouseListenerEx();
Output:
Practical No 12: write a program to demonstrate the use of JTextField and
JPasswordField using Listener Interface.
import javax.swing.*;
import java.awt.*;
f.setVisible(true);
f.setSize(400,400);
f.setLayout(new FlowLayout());
pf.setEchoChar('#');
f.add(pf);
OUTPUT:
Write a Program Using JPasswordField And JTextField To Demonstrate The UseOf
User Authetication.
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
label.setBounds(20,150, 200,50);
value.setBounds(100,75,100,30);
L1.setBounds(20,20, 80,30);
L2.setBounds(20,75, 80,30);
B.setBounds(100,120, 80,30);
text.setBounds(100,20, 100,30);
F.add(value);
F.add(L1);
F.add(label);
F.add(L2);
F.add(B);
F.add(text);
F.setSize(300,350);
F.setLayout(null);
F.setVisible(true);
OUTPUT: