aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/awt/MenuComponent.java
blob: 5c0ea69419a396e10f7e12619c3fa193824cea13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* Copyright (C) 1999, 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;

/* Status: partially complete, untested. */

public abstract class MenuComponent
{
  // Fields from the serialization spec. Decalare others "transient".
  Font font;
  String name;
  boolean nameExplicitlySet;
  boolean newEventsOnly;
  //AccessibleContext accessibleContext;
  
  transient MenuContainer parent;
  transient java.awt.peer.MenuComponentPeer peer;

  public MenuComponent()
  {
  }

  public String getName()
  {
    if (name == null && !nameExplicitlySet)
      name = generateName();
    return name;
  }
  
  /** Subclasses should override this to generate unique names like 
    * "menuitem0".
    */
  String generateName()
  {
    // MenuComponent is abstract.
    return null;
  }

  public void setName(String name)
  {
    nameExplicitlySet = true;
    this.name = name;
  }

  public MenuContainer getParent()
  {
    return parent;
  }

  /** @deprecated Don't use this. */
  public java.awt.peer.MenuComponentPeer getPeer()
  {
    return peer;
  }

  public Font getFont()
  {
    return font;
  }

  public void setFont(Font f)
  {
    this.font = f;
  }

  public void removeNotify()
  {
    // FIXME
  }

  /** @deprecated Replaced by dispatchEvent(AWTEvent) */
  public boolean postEvent(Event evt)
  {
    return false;
  }

  public final void dispatchEvent(AWTEvent e)
  {
    // FIXME
    dispatchEventImpl(e);
  }
  
  void dispatchEventImpl(AWTEvent e)
  {
    // This is overridden by subclasses that support events.
  }

  protected void processEvent(AWTEvent e)
  {
    // Nothing to do here? This is be overridden by subclasses that 
    // support events.
  }

  protected String paramString()
  {
    return name;
  }

  public String toString()
  {
    return this.getClass().getName() + "[" + paramString() + "]";
  }

  protected final Object getTreeLock()
  {
    // FIXME: figure out how the tree lock works.
    return null;
  }

  // Accessibility API not yet implemented.
  // public AccessibleContext getAccessibleContext()
}