This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Button Action Event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply locked New topic

Button Action Event

anu johncy

Joined: Dec 05, 2011
Posts: 11

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();

System.out.println("Name "+name);
System.out.println("Password "+password);

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();

catch(Exception e)



help me please


Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3151

Please CarefullyChooseOneForum.
Lets continue the discussion here.

Mohamed Sanaulla | My Blog
It is sorta covered in the JavaRanch Style Guide.
subject: Button Action Event
jQuery in Action, 3rd edition