mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-31 00:25:49 +08:00
760903c056
* Makefile.in: Rebuilt. * Makefile.am (awt_java_source_files): Added Line2D.java. * java/awt/geom/Line2D.java: Wrote. * java/awt/Menu.java (addNotify): Wrote. * java/awt/PopupMenu.java (addNotify): Implemented. (show): Likewise. * java/awt/Scrollbar.java (addNotify): Call super.addNotify. * java/awt/List.java (addNotify): Call super.addNotify. * java/awt/Label.java (addNotify): Call super.addNotify. * java/awt/FileDialog.java (addNotify): Call super.addNotify. * java/awt/Dialog.java (addNotify): Call super.addNotify. * java/awt/Choice.java (addNotify): Call super.addNotify. * java/awt/CheckboxMenuItem.java (addNotify): Call super.addNotify. * java/awt/Checkbox.java (addNotify): Call super.addNotify. * java/awt/List.java (replaceItem): Notify peer. * java/awt/geom/Rectangle2D.java (Float.setRect(float,float,float,float)): New method. * java/awt/event/ContainerEvent.java (getContainer): Now returns Container. * java/awt/RenderingHints.java (Key): Class now public. * java/awt/Rectangle.java (Rectangle): Now implements Serializable. (getPathIterator): Removed. * java/awt/GraphicsConfiguration.java (GraphicsConfiguration): New constructor. * java/awt/FileDialog.java: Wrote. * java/awt/EventQueue.java (isDispatchThread): Now public. (invokeLater): Likewise. * java/awt/Component.java (setCursor): Update peer. (getFontMetrics): Use peer. * java/awt/ComponentOrientation.java (ComponentOrientation): Class now final. From-SVN: r41489
142 lines
2.6 KiB
Java
142 lines
2.6 KiB
Java
/* Copyright (C) 1999, 2000, 2001 Free Software Foundation
|
|
|
|
This file is part of libjava.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libjava License. Please consult the file "LIBJAVA_LICENSE" for
|
|
details. */
|
|
|
|
package java.awt;
|
|
|
|
import java.util.Vector;
|
|
|
|
/* Status: Incomplete. */
|
|
|
|
public class Menu extends MenuItem implements MenuContainer
|
|
{
|
|
// Fields from the serialization spec. Decalare others "transient".
|
|
Vector items = new Vector();
|
|
boolean tearOff;
|
|
boolean isHelpMenu;
|
|
int menuSerializedDataVersion;
|
|
|
|
static final MenuItem separator = new MenuItem("-");
|
|
|
|
public Menu()
|
|
{
|
|
this(null, false);
|
|
}
|
|
|
|
public Menu(String label)
|
|
{
|
|
this(label, false);
|
|
}
|
|
|
|
public Menu(String label, boolean tearOff)
|
|
{
|
|
super(label);
|
|
this.tearOff = tearOff;
|
|
}
|
|
|
|
public void addNotify()
|
|
{
|
|
if (peer != null)
|
|
{
|
|
// This choice of toolkit seems unsatisfying, but I'm not sure
|
|
// what else to do.
|
|
peer = Toolkit.getDefaultToolkit ().createMenu (this);
|
|
}
|
|
super.addNotify ();
|
|
}
|
|
|
|
public void removeNotify()
|
|
{
|
|
// FIXME
|
|
}
|
|
|
|
public boolean isTearOff()
|
|
{
|
|
return tearOff;
|
|
}
|
|
|
|
public int getItemCount()
|
|
{
|
|
return items.size();
|
|
}
|
|
|
|
/** @deprecated Use getItemCount() instead. */
|
|
public int countItems()
|
|
{
|
|
return getItemCount();
|
|
}
|
|
|
|
public MenuItem getItem(int index)
|
|
{
|
|
return (MenuItem) items.elementAt(index);
|
|
}
|
|
|
|
public synchronized MenuItem add(MenuItem mi)
|
|
{
|
|
items.addElement(mi);
|
|
if (mi.parent != null)
|
|
{
|
|
mi.parent.remove(mi);
|
|
}
|
|
mi.parent = this;
|
|
return mi;
|
|
}
|
|
|
|
public void add(String label)
|
|
{
|
|
MenuItem mi = new MenuItem(label);
|
|
this.add(mi);
|
|
}
|
|
|
|
public synchronized void insert(MenuItem menuitem, int index)
|
|
{
|
|
if (index < 0)
|
|
throw new IllegalArgumentException();
|
|
items.insertElementAt(menuitem, index);
|
|
}
|
|
|
|
public void insert(String label, int index)
|
|
{
|
|
MenuItem mi = new MenuItem(label);
|
|
this.insert(mi, index);
|
|
}
|
|
|
|
public void addSeparator()
|
|
{
|
|
this.add(separator);
|
|
}
|
|
|
|
public void insertSeparator(int index)
|
|
{
|
|
this.insert(separator, index);
|
|
}
|
|
|
|
public synchronized void remove(int index)
|
|
{
|
|
items.removeElementAt(index);
|
|
}
|
|
|
|
public synchronized void remove(MenuComponent item)
|
|
{
|
|
items.removeElement(item);
|
|
}
|
|
|
|
public synchronized void removeAll()
|
|
{
|
|
items.removeAllElements();
|
|
}
|
|
|
|
public String paramString()
|
|
{
|
|
return getName() + ",label" + label + ",tearOff=" + tearOff +
|
|
",isHelpMenu=" + isHelpMenu;
|
|
}
|
|
|
|
// Accessibility API not yet implemented.
|
|
// public AccessibleContext getAccessibleContext()
|
|
}
|