Hi Daniel,
Yes i have called the methods in the init method ...see my program is like this ...
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class TestCard1 extends Applet implements ActionListener
{
Button btnLogin = null ;
Button btnExit = null ;
Button btnBack = null ;
Panel firstPanel = null ;
Panel secondPanel = null ;
public void init()
{
firstPanel = new Panel();
secondPanel = new Panel();
CardLayout cardLayout = new CardLayout();
this.setLayout ( cardLayout );
formFirstPanel( firstPanel );
formSecondPanel( secondPanel );
this.add( firstPanel , "Option");
this.add( secondPanel , "Login");
this.setSize(200,400);
cardLayout.show( this, "Option");
this.show(true);
}
void formFirstPanel( Panel firstPanel )
{
btnLogin = new Button ("Login");
btnExit = new Button ("Exit");
btnLogin.addActionListener( this );
btnExit.addActionListener( this );
firstPanel.add (btnLogin);
firstPanel.add (btnExit);
}
void formSecondPanel( Panel secondPanel )
{
TextField name = new TextField(25);
TextField password = new TextField(25);
btnBack = new Button("Back");
secondPanel.add (name);
secondPanel.add (password);
secondPanel.add (btnBack);
btnBack.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if ( e.getSource () == btnLogin )
{
CardLayout c1 = ( CardLayout ) this.getLayout();
c1.show( this , "Login" );
}
if ( e.getSource () == btnBack )
{
CardLayout c1 = ( CardLayout ) this.getLayout();
c1.show( this , "Option" );
}
if ( e.getSource () == btnExit )
{
System.exit (0);
}
}
/* public static void main(
String[] str )
{
TestCard1 card = new TestCard1();
card.init();
}*/
}
Here i am calling two methds formFirstPanel( Panel firstPanel ) & formSecondPanel( Panel firstPanel )....right
So now what i want is I need to put this two metods in a frame i.e. it should appear as if a pop up window is opened
Please help me out...
Can a metod be added in a frame..
Kajol
[This message has been edited by Kajol Shroff (edited March 13, 2001).]
[This message has been edited by Kajol Shroff (edited March 13, 2001).]