Showing posts with label Action Event applet. Show all posts
Showing posts with label Action Event applet. Show all posts

The ItemEvent class in java programming

Saturday, 17 November 2012
An itemEvent is generated when a check or a list item is clicked or when a check able menu item is selected or deselected .There are two types of item events,which are identified by the following integer

DESELECTED
the user deselected an item

SELECTED 
the use selected an item

in addition ItemEvent defines one integer constant ITEM_STATE_CHANGED that signifies a change of state

ItemEvent has this constructor

ItemEvent(ItemSelectable src,int type,Object entry,int state)






getItem()


The getItem() method can be used to obtain a reference to the item that generated an event .Its signature is show here

Object getItem()

getItemSelectable()

The getItemSelectable() method can be used to obtain a reference to the ItemSelectable object that generated an event

ItemSelectable getItemSelectable()

getStateChange()

The getStateChange() method returns the satechange for the event

int getStateChange()

Action Event class in java Programming

Friday, 16 November 2012

An ActionEvent is generated when a button is pressed ,a lis item is double clicked or menu item is selected .The Action Event class defines four integer constants that can be used to identity any modifiers associated with an action event ALT_MASK ,CTRL_MASK,META_MASK and SHIFT_MASK.In addition there is an integer constant ACTION_PERFORMED which can be to identity action events

ActionEvent has these three constructors


ActionEvent(Object src,int type,String cmd)
ActionEvent(Object src,int type,String cmd,int modifiers)
ActionEvent(Object src,int type,String cmd,long when,int modifiers)


src is a reference to the object that generated this event .the type of the specified by Type ,and its command string is cmd,the argument modifiers indicates which modifiers key(ALT,CTRL,META,SHIFT) were pressed when the event was generated .The when parameter specifies when the event occurred.

getActionCommand()

When a button is pressed an action event is generated that has a command name equal to the label on that button

getModifiers()

The getModifiers() method returns a value that indicates which modifiers keys(ALT(CTRL,META,SHIFT) were pressed when the event was generated .

getWhen()

The getWhen() that returns the time at which the event took place.This is called the event's timestamps.


 

learn java programming Copyright © 2011-2012 | Powered by appsackel.org