Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "META_KEY" Watch "META_KEY" New topic


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()) {
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.
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
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
I agree. Here's the link:
subject: META_KEY
It's not a secret anymore!