Hi Arun,
Your makePanel method was creating the problem, dont call mp = new ..in ur main class.., first of all declare ur memmer variables in main class, then in ur test constructor call methods which will create define the members & create the panels..
test
{
JLabel j;
public test()
{
buildToolbarPanel();
buildMainPanel();
.
.
}
buildMainPanel()
{
j = new JLabel();
....
}
.
.
}
also try not to create a monolithic code for ur actionPerformed(), try as far as possible to use adapter or inner anonymous classes & in each u can call methods so they can be reused, for eg.
login.addActionListener( new ActionListener()
{
public void actionPerfomed(ActionEvent ev)
{
doAction();//u could reuse this doAction
}
});
try to avoid creating unnecessary objects..thats the most common of mistakes as u learn,..
& u will learn more & more tricks by reading Javaranch's code snippets