This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
    Bookmark Topic Watch Topic
  • New Topic

Button Action Event

 
anu johncy
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Report post to moderator
hai,

I create one login page , the button event is not taking , the code is following


package login;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import database.DataBaseConnection;
import design.LoginFrame;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.sql.Connection;
import java.sql.DriverManager;

//Login User -- Check Login is correct or Not
class loginSubclass extends JFrame //implements ActionListener
{
String name,password;

public loginSubclass()
{

System.out.println("Inside login subclass");
design.LoginFrame frame=new design.LoginFrame();
name=frame.txtName.getText();
password=frame.txtPass.getText();

System.out.println("Name "+name);
System.out.println("Password "+password);
frame.btnLogin.setActionCommand("login");

frame.btnLogin.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e)
{
//Execute when button is pressed
System.out.println("You clicked the button,,,,,,,,,");
}
});



}


}



public class LoginUser {


public static void main(String[] args) {

try {
System.out.println("Login user");
loginSubclass login=new loginSubclass();
design.LoginFrame LF=new design.LoginFrame();
LF.setVisible(true);
//LF.initGUI();


}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e.getMessage());
System.out.println(e);

}
}


}

help me please

regards

Anu
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please CarefullyChooseOneForum.
Lets continue the discussion here.
 
    Bookmark Topic Watch Topic
  • New Topic