dcsimg
Is KeyListener work for scrollbar?
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   raheem_Abdul
Posted On:   Thursday, April 12, 2001 12:31 AM

Is KeyListener work for scrollbar?How to handle that on left & right arrows?
Please mail this answer to my mail_id :

raheem76@yahoo.com

Re: Is KeyListener work for scrollbar?

Posted By:   Hans_Meise  
Posted On:   Friday, April 20, 2001 03:34 AM

Here is a descrition of the relevant method of class KeyEvent:

public int getKeyCode()
Returns the integer key-code associated with the key in this event.
Returns:
the integer code for an actual key on the keyboard. (For KEY_TYPED events, keyCode is VK_UNDEFINED.)

If you extend class KeyAdapter for your listener class you usually override at least one of its three methods. E.g. keyPressed(KeyEvent e){....your code....}. Use the method getKeyCode()(for example) of the local variable e to ckeck if a "scroll key" has been pressed.

Best wishes, hans

Re: Is KeyListener work for scrollbar?

Posted By:   Hans_Meise  
Posted On:   Friday, April 20, 2001 03:20 AM

Here is an extract from the jdk 1.3 api documentation:

Normally, the user changes the value of the scroll bar by making a gesture with the mouse. For example, the user can drag the scroll bar's bubble up and down, or click in the scroll bar's unit increment or block increment areas. Keyboard gestures can also be mapped to the scroll bar. By convention, the Page Up and Page Down keys are equivalent to clicking in the scroll bar's block increment and block decrement areas.
About | Sitemap | Contact