Big AWT patch.
From-SVN: r34976
This commit is contained in:
parent
406a65d0db
commit
c7a136d3ef
70 changed files with 4838 additions and 277 deletions
|
@ -8,26 +8,128 @@ details. */
|
|||
|
||||
package java.awt;
|
||||
|
||||
/* A very incomplete placeholder. */
|
||||
import java.util.Vector;
|
||||
|
||||
/* Status: Incomplete. */
|
||||
|
||||
public class Menu extends MenuItem implements MenuContainer
|
||||
{
|
||||
public Menu (String label)
|
||||
// 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()
|
||||
{
|
||||
super(label); // ???
|
||||
throw new Error ("java.awt.Menu: not implemented");
|
||||
this(null, false);
|
||||
}
|
||||
|
||||
public Menu(String label)
|
||||
{
|
||||
this(label, false);
|
||||
}
|
||||
|
||||
public Menu(String label, boolean tearOff)
|
||||
{
|
||||
super(label);
|
||||
this.tearOff = tearOff;
|
||||
}
|
||||
|
||||
public void add (String label)
|
||||
{ /* FIXME */ }
|
||||
|
||||
public synchronized MenuItem add (MenuItem item)
|
||||
public void addNotify()
|
||||
{
|
||||
/* FIXME */
|
||||
return item;
|
||||
// FIXME
|
||||
}
|
||||
|
||||
public Font getFont() { return null; } // FIXME
|
||||
public boolean postEvent(Event evt) { return false; } // FIXME
|
||||
public void remove(MenuComponent comp) { } // FIXME
|
||||
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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue