Saturday, 1 February 2014

Event Classes:The AdjustmentEvent Class

AdjustmentEvent:BLOCK-DECREMENT,TRACK,INTEGER CONSTANT

The AdjustmentEvent Class

An AdjustmentEvent is generated by a scroll bar.

Adjustment events.


  • 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.



 Integer constant


 ADJUSTMENT_VALUE_CHANGED:    that indicates that a change has occurred.


AdjustmentEvent constructor:


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

Here,src is a reference to the object that generated this event. The id specifies the event. The type of the adjustment is specified by type, and its associated data is data.


Methods in AdjustableEvent class:


1) getAdjustable( ) method :

It returns the object that generated the event. Its form is shown here:

Adjustable getAdjustable()

2) getAdjustmentType( ) method:

The type of the adjustment event may be obtained by the getAdjustmentType( ) method. It returns one of the constants defined by AdjustmentEvent. The general form is shown here:

int getAdjustmentType( )

 3) getValue( ) method:

The amount of the adjustment can be obtained from the getValue( ) method, shown here:

int getValue( )

For example, when a scroll bar is manipulated, this method returns the value represented by that change.

No comments:

Post a Comment