mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-18 17:50:03 +08:00
b3b90f82f4
* java/awt/MenuItem.java (paramString): Now protected. * java/awt/MenuShortcut.java: Implements Serializable. * java/awt/MenuBar.java: Rewrote from scratch. * java/awt/MenuComponent.java (removeNotify): Wrote. Implements Serializable. * java/awt/GridBagConstraints.java (GridBagConstraints): New constructor. * java/awt/CheckboxMenuItem.java: Wrote. From-SVN: r38488
76 lines
1.4 KiB
Java
76 lines
1.4 KiB
Java
/* Copyright (C) 2000 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
package java.awt;
|
|
|
|
import java.awt.event.KeyEvent;
|
|
|
|
/* Status: Complete, except for hashCode(). Untested. */
|
|
|
|
public class MenuShortcut implements java.io.Serializable
|
|
{
|
|
// Fields from the serialization spec. Decalare others "transient".
|
|
int key;
|
|
boolean usesShift;
|
|
|
|
public MenuShortcut(int key)
|
|
{
|
|
this.key = key;
|
|
}
|
|
|
|
public MenuShortcut(int key, boolean useShiftModifier)
|
|
{
|
|
this.key = key;
|
|
this.usesShift = useShiftModifier;
|
|
}
|
|
|
|
public int getKey()
|
|
{
|
|
return key;
|
|
}
|
|
|
|
public boolean usesShiftModifier()
|
|
{
|
|
return usesShift;
|
|
}
|
|
|
|
public boolean equals(MenuShortcut ms)
|
|
{
|
|
return (ms.key == key && ms.usesShift == usesShift);
|
|
}
|
|
|
|
public boolean equals(Object obj)
|
|
{
|
|
if (obj instanceof MenuShortcut)
|
|
{
|
|
MenuShortcut ms = (MenuShortcut) obj;
|
|
return (ms.key == key && ms.usesShift == usesShift);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode()
|
|
{
|
|
// FIXME: find/implement the correct algorithm for this
|
|
if (usesShift)
|
|
return (2 * key);
|
|
else
|
|
return key;
|
|
}
|
|
|
|
public String toString()
|
|
{
|
|
return paramString(); // ?
|
|
}
|
|
|
|
protected String paramString()
|
|
{
|
|
return KeyEvent.getKeyText(key);
|
|
}
|
|
}
|