hello, i need to create an applet for a "company", in which you log in, and according to your possition(ex: worker, manager) you can see and change different objects such as sallery and the abililty to fire people. im completely stuck on the login part, i have the gui set up but i can't figure out how to get myself to login. this is what i have thus far.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
public class driver extends JApplet
{
private ButtonListener listener;
private JButton btnLogin;
private JTextField txtUser;
private JPasswordField txtPass;
private JLabel lblAccepted;
public String User, Pass;
public void init()
{
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
listener = new ButtonListener();
txtUser = new JTextField("Username");
txtPass = new JPasswordField("Password");
btnLogin = new JButton("Login");
btnLogin.addActionListener(listener);
lblAccepted = new JLabel();
txtUser.setColumns(10);
txtPass.setColumns(10);
txtPass.setEchoChar('*');
cp.add(txtUser);
cp.add(txtPass);
cp.add(btnLogin);
cp.add(lblAccepted);
}
public class ButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent event)
{
Object source = event.getSource();
if (source==btnLogin)
{
User = new String(txtUser.getText());
Pass = new String(txtPass.getPassword());
}
}
}
}
any help would be much appreciated.