Hey, can anybody help me.. I want to open a welcome screen after textboxes on a password screen are filled in correctly.
I tried Welcome.show(); but doesnt work..probably cos its completely wrong.

Heres the code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class PassWordInterface extends JFrame implements ActionListener{



private JLabel nameLabel, passWordLabel, EMCLabel;
private JTextField nameTextField;
private JPasswordField passwordTextField;
private JButton okButton, CancelButton;
private String username = "emc";
private String password = "hello";
private String user;
private String pass;



public PassWordInterface(){

super("Enter Password");
setBounds(200, 200, 350, 200);
GridBagLayout layout = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
JPanel pane = new JPanel();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pane.setLayout(layout);
ImageIcon EMC = new ImageIcon("EMC.gif");

createConstraints(constraints, 0, 0, 4, 1, 0, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.CENTER;
EMCLabel = new JLabel(EMC);
layout.setConstraints(EMCLabel, constraints);
pane.add(EMCLabel);

createConstraints(constraints, 0, 1, 1, 1, 50, 20);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
nameLabel = new JLabel ("Name:", JLabel.LEFT);
layout.setConstraints(nameLabel, constraints);
pane.add(nameLabel);


createConstraints(constraints, 1, 1, 2, 1, 50, 20);
constraints.fill = GridBagConstraints.HORIZONTAL;
nameTextField = new JTextField();
layout.setConstraints(nameTextField, constraints);
pane.add(nameTextField);

createConstraints(constraints, 0, 2, 1, 1, 50, 20);
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
passWordLabel = new JLabel ("Password:", JLabel.LEFT);
layout.setConstraints(passWordLabel, constraints);
pane.add(passWordLabel);


createConstraints(constraints, 1, 2, 2, 1, 50, 20);
constraints.fill = GridBagConstraints.HORIZONTAL;
passwordTextField = new JPasswordField();
passwordTextField.setEchoChar('*');
layout.setConstraints(passwordTextField, constraints);
pane.add(passwordTextField);


createConstraints(constraints, 0, 3, 1, 1, 30, 40);
constraints.fill = GridBagConstraints.HORIZONTAL;
//constraints.anchor = GridBagConstraints.CENTER;
okButton = new JButton ("OK");
okButton.addActionListener(this);
layout.setConstraints(okButton, constraints);
pane.add(okButton);


createConstraints(constraints, 2, 3, 1, 4, 40, 40);
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.CENTER;
CancelButton = new JButton ("Clear");
CancelButton.addActionListener(this);
layout.setConstraints(CancelButton, constraints);
pane.add(CancelButton);


setContentPane(pane);
}


private void createConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, int wy){

gbc.gridx = gx;
gbc.gridy = gy;
gbc.gridwidth = gw;
gbc.gridheight = gh;
gbc.weightx = wx;
gbc.weighty = wy;

}

public static void main (String args[]){

PassWordInterface test = new PassWordInterface();
test.show();
}


public void actionPerformed(ActionEvent e)
{
if (e.getSource()==okButton)
{
user = nameTextField.getText();
pass = passwordTextField.getText();

if(pass.equals(password) & user.equals(username))
{

nameTextField.setText("");
passwordTextField.setText("");
setVisible(false);
LeadScreen.show();
JOptionPane.showMessageDialog(null, "Welcome to "+ nameTextField.getText());
}
else
{
JOptionPane.showMessageDialog(null, "Access Denied!");
}
}

if(e.getSource()==CancelButton)
{
nameTextField.setText("");
passwordTextField.setText("");
}
}
}