Showing posts with label awtevent. Show all posts
Showing posts with label awtevent. Show all posts

The ComponentEvent class in java Programming

Friday, 16 November 2012

A ComponentEvent  is generated when the size ,position or visibility of a component is changed .There are four types of component events.The ComponentEvent class defines integer constants that can be used to identity them.The constants and their meaning are shown here

COMPONENT_HIDDEN -The component was hidden

COMPONENT_MOVED -The component was moved

COMPONENT_RESIZED -The component was re sized

COMPONENT_SHOWN - The component became visible


ComponentEvent has this constructor

ComponentEvent(Component src,int type)

here src is a reference to the object that generated this event.The type of the events is specified by type
ComponentEvent is the supercladd either directly or indirectly of ContainerEvent ,FocusEvent,KeyEvent,MouseEvent and WindowEvent

getcomponent()

The method returns the component that generated the event .


The AdjustmentEvent class in java programming


An AdjustmentEvent  is generated by a scroll bar.There are five types of adjustment events .The AdjustmentEvent  class defines integer constants that can be used to identity them,The constants and their meanings are shown

BLOCK_DECREMENT  -The user clicked inside the scroll bar to decrease its value
BLOCK_INCREMENT -The user clicked inside the scroll bar to increase its value
TRACK  -The slider was dragged
UNIT_DECREMENT -The button at the end of the scroll bar was clicked to decrease its value.
UNIT_INCREMENT -The button at the end of the scroll bar was clicked to increase its value


In addition there is an integer constant ADJUSTMENT_VALUE_CHANGED, that indicates that a change has occurred

AdjustmentEvent(adjustable src,int id,int type,int data)

Adjustable getAdjustable()

The geAdjustable() method returns the object that generated the event

int getAdjustmentType()

The type of the adjustmewnt event may be obtained by the getAdjustmentType() method.it returns one of the constants defined by AdjustmentEvent

int getValue()

 the amount of the adjustment can be obtained from the getValue() method
 

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