This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes META_KEY Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "META_KEY" Watch "META_KEY" New topic
Author

META_KEY

Vijay Venkat
Ranch Hand

Joined: Aug 12, 2001
Posts: 52
What is meant by META-KEY in java terminology.
I am absolutely confused - Can anyone make it very clear for me

here is a code snippet -

// act on JTable row right-click
MouseListener ml = new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.isShiftDown()| |e.isControlDown()| |e.isAltDown()) {
return;
}
if (e.isMetaDown()) {
int row = rowAtPoint(mouseEvent.getPoint());
file://your code here
}
}
}

Any way which key does META_KEY refer to on the key board.

Thanks in advance.
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
I found that:
"metaKey of type boolean, readonly
Used to indicate whether the 'meta' key was depressed during the firing of the event. On some platforms this key may map to an alternative key name."
what I know is, that META key mostly is used synonymous for the ALT key.
chantal
Vijay Venkat
Ranch Hand

Joined: Aug 12, 2001
Posts: 52
Thanks for the info - sorry for the delay from my side.
Here is some information that i figured out and checked
META_KEY
The user can hold down certain modifier keys while using the mouse. The possible modifier keys include: the Shift key, the Control key, the ALT key (called the Option key on the Macintosh), and the Meta key (called the Command or Apple key on the Macintosh and with no equivalent in Windows). You might want to respond to a mouse event differently when the user is holding down a modifier key. The boolean-valued instance methods evt.isShiftDown(), evt.isControlDown(), evt.isAltDown(), and evt.isMetaDown() can be called to test whether the modifier keys are pressed.
You might also want to have different responses depending on whether the user presses the left mouse button, the middle mouse button, or the right mouse button. Now, not every mouse has a middle button and a right button, so Java handles the information in a peculiar way. It treats pressing the right button as equivalent to holding down the Meta key. That is, if the right button is pressed, then the instance method evt.isMetaDown() will return true (even if the Meta key is not pressed). Similarly, pressing the middle mouse button is equivalent to holding down the ALT key. In practice, what this really means is that pressing the right mouse button under Windows is equivalent to holding down the Command key while pressing the mouse button on Macintosh. A program tests for either of these by calling evt.isMetaDown().
Thanks / Regards / Vijay.V
 
Consider Paul's rocket mass heater.
 
subject: META_KEY