Error:
Exception in thread "main" java.lang.NullPointerException
at adminlogin.launchframe(adminlogin.java:30)
at adminlogin.main(adminlogin.java:68)
my code is:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class adminlogin implements ActionListener//,FocusListener
{
private JFrame f;
private JLabel l1,l2,l3;
private JTextField tf1;
private JPasswordField pf1;
private JButton b1;
public adminlogin()
{
l1=new JLabel("Admin Login");
l2=new JLabel("Enter Username");
l3=new JLabel("Enter Password");
tf1=new JTextField();
pf1=new JPasswordField();
b1=new JButton("Login");
}
public void launchframe()
{
f.setLayout(null);
f.add(l1);
f.add(l2);
//f.add(l3);
f.add(tf1);
//f.add(pf1);
//f.add(b1);
l1.setBounds(600,200,100,25);
l2.setBounds(500,250,150,25);
tf1.setBounds(600,250,150,25);
f.setSize(2000,2000);
f.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
/*
if(e.getSource()==b1)
{
staffdata sd=new staffdata();
sd.launchframe();
f.setVisible(false);
}*/
}
/*public void focusLost(FocusEvent fe)
{}
public void focusGained(FocusEvent fe1)
{}*/
public static void main(String args[])
{
adminlogin ac =new adminlogin();
ac.launchframe();
}
}
pls help me to solve this problem!!!!
urgent!!!
thanks in advance