programming-examples/java/Core_Java/Testing a code.java
2019-11-15 12:59:38 +01:00

42 lines
847 B
Java

Testing a code
import javax.swing.*;
public class abc extends JFrame implements ActionListener
{
JPanel p;
JButton b;
JTextField t;
JLabel l,i;
public abc()
{
p=new JPanel();
b=new JButton("click");
t=new JTextField(15);
l=new JLabel("enter ur id");
p.add(l);
p.add(t);
p.add(b);
getContentPane().add(p);
setSize(400,400);
setVisible(true);
b.addActionListener(this);
}
public static void main(String []aa)
{
abc a= new abc();
}
public void actionPerformed(ActionEvent e)
{
Object o= e.getSource();
if(o==b)
{
i=new JLabel("U Have Entered Wrong Value");
}
}
}