Results 1 to 4 of 4

Thread: What is event handling in the java programming?

  1. #1
    Join Date
    Nov 2009
    Posts
    652

    What is event handling in the java programming?

    Hi,

    I need your help to understand the event handling concept. I know delegate very well but don't know what is exact functioning of events in java.
    What is event handling in the java programming?If anybody know anything about java events then please let know that. Your help will be greatly appreciable.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is event handling in the java programming?

    Hi all,

    The event handling mechanism is used to represent the activities which is going on between the java program user and the java application.
    Following are some stages of the event handling mechanism of Java:

    1. Import java event classes by using "import java.awt.event.*;
    2. Then define override class.
    3. Then define an object of event listener.
    e.g ButtonListener abc = new ButtonListener();
    4. Finallay make registration of the object of event listener
    e.g x = new Button(“submit”);

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: What is event handling in the java programming?

    Hi,

    I have the java program code which will explains how to use the different events classes in the java code:

    import java.awt.event.*;
    import java.applet.*;
    import java.awt.*;

    /*
    <applet code="MouseDemo" width=200 height=200>
    </applet>
    */
    public class MouseDemo extends Applet {

    public void init()
    {
    setBackground(Color.Blue);
    addMouseListener(new MyMouseAdp());
    }

    class MyMouseAdp extends MouseAdapter {

    public void mouseReleased(MouseEvent be) {
    setBackground(Color.yellow);
    repaint();
    }

    public void mousePressed(MouseEvent be) {
    setBackground(Color.orange);
    repaint();
    }

    }
    }

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: What is event handling in the java programming?

    Hi friends,

    The basic concept of the event handling mechanism comprises "Events source", "Event Objects", "Event handler" and "Event classes". There are different methods which are used to handle the mouse events which are as follows:

    *. void mousePressed(MouseEvent m)
    *. void mouseReleased(MouseEvent m)
    *. void mouseClicked(MouseEvent m)
    *. void mouseEntered(MouseEvent m)
    *. void mouseExited(MouseEvent m)

Similar Threads

  1. Event Listeners in programming
    By VAIJAYI in forum Software Development
    Replies: 4
    Last Post: 29-12-2010, 12:54 AM
  2. Programming in Android, problem of inheritance and object handling
    By Lalitmohan in forum Software Development
    Replies: 5
    Last Post: 27-11-2010, 12:06 PM
  3. Is File handling in Java Swing possible
    By Vivan in forum Software Development
    Replies: 5
    Last Post: 20-07-2010, 11:51 PM
  4. Java Programming using Adventnet SNMP Java API
    By ROCKING_Suhas in forum Software Development
    Replies: 5
    Last Post: 17-07-2010, 06:52 AM
  5. Difference between throw and throws in Java Exception Handling
    By KALYAN23 in forum Software Development
    Replies: 3
    Last Post: 09-11-2009, 11:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,567,043.78155 seconds with 16 queries