[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: accessibility fixes

Kaffe CVS cvs-commits at kaffe.org
Wed Jan 5 13:11:17 PST 2005


PatchSet 5772 
Date: 2005/01/05 20:16:24
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: accessibility fixes

Members: 
	ChangeLog:1.3316->1.3317 
	libraries/javalib/java/awt/CheckboxMenuItem.java:1.13->1.14 
	libraries/javalib/java/awt/Choice.java:1.4->1.5 
	libraries/javalib/java/awt/Dialog.java:1.11->1.12 
	libraries/javalib/java/awt/Frame.java:1.21->1.22 
	libraries/javalib/java/awt/List.java:1.4->1.5 
	libraries/javalib/java/awt/MenuComponent.java:1.14->1.15 
	libraries/javalib/java/awt/MenuItem.java:1.16->1.17 
	libraries/javalib/java/awt/ScrollPane.java:1.17->1.18 
	libraries/javalib/java/awt/Scrollbar.java:1.6->1.7 
	libraries/javalib/java/awt/Window.java:1.25->1.26 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3316 kaffe/ChangeLog:1.3317
--- kaffe/ChangeLog:1.3316	Wed Jan  5 20:12:37 2005
+++ kaffe/ChangeLog	Wed Jan  5 20:16:24 2005
@@ -2,6 +2,29 @@
 
 	Resynced with GNU Classpath.
 
+	2004-12-29  Jerry Quinn  <jlquinn at optonline.net>
+
+	* java/awt/CheckboxMenuItem.java (getAccessibleContext,
+	AccessibleAWTCheckboxMenuItem): Implement.
+	* java/awt/Choice.java: Add implements declaration for Accessible.
+	* java/awt/Dialog.java (AccessibleAWTFrame, getAccessibleContext):
+	Implement.
+	* java/awt/Frame.java (AccessibleAWTFrame, getAccessibleContext):
+	Implement.
+	* java/awt/List.java: Implement AccessibleAWTList, AccessibleAWTListChild.
+	* java/awt/MenuComponent.java (accessibleContext): Make package visible.
+	* java/awt/MenuItem.java (getAccessibleContext): Implement.
+	* java/awt/Scrollbar.java (AccessibleAWTScrollbar, getAccessibleContext):
+	Implement.
+	* java/awt/ScrollPane.java (AccessibleAWTScrollPane, getAccessibleContext):
+	Implement.
+	* java/awt/Window.java (AccessibleAWTWindow): Implement.
+	(isActive, isFocused, getAccessibleContext): Implement.
+	
+2005-01-05  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2004-12-29  Michael Koch  <konqueror at gmx.de>
 
 	* javax/swing/text/TextAction.java
Index: kaffe/libraries/javalib/java/awt/CheckboxMenuItem.java
diff -u kaffe/libraries/javalib/java/awt/CheckboxMenuItem.java:1.13 kaffe/libraries/javalib/java/awt/CheckboxMenuItem.java:1.14
--- kaffe/libraries/javalib/java/awt/CheckboxMenuItem.java:1.13	Wed Nov 24 21:49:17 2004
+++ kaffe/libraries/javalib/java/awt/CheckboxMenuItem.java	Wed Jan  5 20:16:25 2005
@@ -43,6 +43,11 @@
 import java.awt.peer.CheckboxMenuItemPeer;
 import java.util.EventListener;
 
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleValue;
+
 /**
   * This class implements a menu item that has a checkbox on it indicating
   * the selected state of some option.
@@ -50,7 +55,8 @@
   * @author Aaron M. Renn (arenn at urbanophile.com)
   * @author Tom Tromey <tromey at redhat.com>
   */
-public class CheckboxMenuItem extends MenuItem implements ItemSelectable
+public class CheckboxMenuItem extends MenuItem
+  implements ItemSelectable, Accessible
 {
 
 /*
@@ -315,5 +321,30 @@
   {
     return (ItemListener[]) getListeners (ItemListener.class);
   }
+
+
+  protected class AccessibleAWTCheckboxMenuItem extends AccessibleAWTMenuItem
+    implements AccessibleAction, AccessibleValue
+  {
+    // I think the base class provides the necessary implementation
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>List</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTCheckboxMenuItem();
+      }
+    return accessibleContext;
+  }
+
 } // class CheckboxMenuItem
 
Index: kaffe/libraries/javalib/java/awt/Choice.java
diff -u kaffe/libraries/javalib/java/awt/Choice.java:1.4 kaffe/libraries/javalib/java/awt/Choice.java:1.5
--- kaffe/libraries/javalib/java/awt/Choice.java:1.4	Fri Dec  3 01:56:21 2004
+++ kaffe/libraries/javalib/java/awt/Choice.java	Wed Jan  5 20:16:25 2005
@@ -45,6 +45,7 @@
 import java.util.EventListener;
 import java.util.Vector;
 
+import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
 import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
@@ -54,7 +55,8 @@
   *
   * @author Aaron M. Renn (arenn at urbanophile.com)
   */
-public class Choice extends Component implements ItemSelectable, Serializable
+public class Choice extends Component
+  implements ItemSelectable, Serializable, Accessible
 {
 
 /*
Index: kaffe/libraries/javalib/java/awt/Dialog.java
diff -u kaffe/libraries/javalib/java/awt/Dialog.java:1.11 kaffe/libraries/javalib/java/awt/Dialog.java:1.12
--- kaffe/libraries/javalib/java/awt/Dialog.java:1.11	Thu Jul 22 19:20:22 2004
+++ kaffe/libraries/javalib/java/awt/Dialog.java	Wed Jan  5 20:16:25 2005
@@ -40,6 +40,11 @@
 
 import java.awt.peer.DialogPeer;
 
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
 /**
  * A dialog box widget class.
  *
@@ -511,5 +516,41 @@
 
     this.undecorated = undecorated;
   }
+  
+  protected class AccessibleAWTDialog extends AccessibleAWTWindow
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.DIALOG;
+    }
+    
+    public AccessibleStateSet getAccessibleState()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isResizable())
+        states.add(AccessibleState.RESIZABLE);
+      if (isModal())
+        states.add(AccessibleState.MODAL);
+      return states;
+    }
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>Dialog</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTDialog();
+      }
+    return accessibleContext;
+  }
+
 } // class Dialog
 
Index: kaffe/libraries/javalib/java/awt/Frame.java
diff -u kaffe/libraries/javalib/java/awt/Frame.java:1.21 kaffe/libraries/javalib/java/awt/Frame.java:1.22
--- kaffe/libraries/javalib/java/awt/Frame.java:1.21	Tue Oct 12 00:24:58 2004
+++ kaffe/libraries/javalib/java/awt/Frame.java	Wed Jan  5 20:16:25 2005
@@ -41,6 +41,11 @@
 import java.awt.peer.FramePeer;
 import java.util.Vector;
 
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
 /**
   * This class is a top-level window with a title bar and window
   * decorations.
@@ -549,4 +554,40 @@
   {
     return next_frame_number++;
   }
+  
+  protected class AccessibleAWTFrame extends AccessibleAWTWindow
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.FRAME;
+    }
+    
+    public AccessibleStateSet getAccessibleState()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isResizable())
+        states.add(AccessibleState.RESIZABLE);
+      if ((state & ICONIFIED) != 0)
+        states.add(AccessibleState.ICONIFIED);
+      return states;
+    }
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>Frame</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTFrame();
+      }
+    return accessibleContext;
+  }
+
 }
Index: kaffe/libraries/javalib/java/awt/List.java
diff -u kaffe/libraries/javalib/java/awt/List.java:1.4 kaffe/libraries/javalib/java/awt/List.java:1.5
--- kaffe/libraries/javalib/java/awt/List.java:1.4	Wed Nov 24 21:49:17 2004
+++ kaffe/libraries/javalib/java/awt/List.java	Wed Jan  5 20:16:26 2005
@@ -47,6 +47,11 @@
 import java.util.Vector;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 
 /**
   * Class that implements a listbox widget
@@ -106,6 +111,7 @@
 // The list of ActionListeners for this object.
 private ActionListener action_listeners;
 
+
 /*************************************************************************/
 
 /*
@@ -1075,5 +1081,186 @@
   public ItemListener[] getItemListeners ()
   {
     return (ItemListener[]) getListeners (ItemListener.class);
+  }
+  
+  // Accessibility internal class 
+  protected class AccessibleAWTList extends AccessibleAWTComponent
+    implements AccessibleSelection, ItemListener, ActionListener
+  {
+    protected class AccessibleAWTListChild extends AccessibleAWTComponent
+      implements Accessible
+    {
+      private int index;
+      private List parent;
+      
+      public AccessibleAWTListChild(List parent, int indexInParent)
+      {
+        this.parent = parent;
+        index = indexInParent;
+        if (parent == null)
+          index = -1;
+      }
+      
+      /* (non-Javadoc)
+       * @see javax.accessibility.Accessible#getAccessibleContext()
+       */
+      public AccessibleContext getAccessibleContext()
+      {
+        return this;
+      }
+      
+      public AccessibleRole getAccessibleRole()
+      {
+        return AccessibleRole.LIST_ITEM;
+      }
+      
+      public AccessibleStateSet getAccessibleStateSet()
+      {
+        AccessibleStateSet states = super.getAccessibleStateSet();
+        if (parent.isIndexSelected(index))
+          states.add(AccessibleState.SELECTED);
+        return states;
+      }
+      
+      public int getAccessibleIndexInParent()
+      {
+        return index;
+      }
+
+    }
+    
+    public AccessibleAWTList()
+    {
+      addItemListener(this);
+      addActionListener(this);
+    }
+    
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.LIST;
+    }
+    
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      states.add(AccessibleState.SELECTABLE);
+      if (isMultipleMode())
+        states.add(AccessibleState.MULTISELECTABLE);
+      return states;
+    }
+
+    public int getAccessibleChildrenCount()
+    {
+      return getItemCount();
+    }
+
+    public Accessible getAccessibleChild(int i)
+    {
+      if (i >= getItemCount())
+        return null;
+      return new AccessibleAWTListChild(List.this, i);
+    }
+    
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelectionCount()
+     */
+    public int getAccessibleSelectionCount()
+    {
+      return getSelectedIndexes().length;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelection()
+     */
+    public AccessibleSelection getAccessibleSelection()
+    {
+      return this;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#getAccessibleSelection(int)
+     */
+    public Accessible getAccessibleSelection(int i)
+    {
+      int[] items = getSelectedIndexes();
+      if (i >= items.length)
+        return null;
+      return new AccessibleAWTListChild(List.this, items[i]);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#isAccessibleChildSelected(int)
+     */
+    public boolean isAccessibleChildSelected(int i)
+    {
+      return isIndexSelected(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#addAccessibleSelection(int)
+     */
+    public void addAccessibleSelection(int i)
+    {
+      select(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#removeAccessibleSelection(int)
+     */
+    public void removeAccessibleSelection(int i)
+    {
+      deselect(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#clearAccessibleSelection()
+     */
+    public void clearAccessibleSelection()
+    {
+      for (int i = 0; i < getItemCount(); i++)
+        deselect(i);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleSelection#selectAllAccessibleSelection()
+     */
+    public void selectAllAccessibleSelection()
+    {
+      if (isMultipleMode())
+        for (int i = 0; i < getItemCount(); i++)
+          select(i);
+    }
+
+    /* (non-Javadoc)
+     * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+     */
+    public void itemStateChanged(ItemEvent event)
+    {
+    }
+
+    /* (non-Javadoc)
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+     */
+    public void actionPerformed(ActionEvent event)
+    {
+    }
+    
+  }
+
+  /**
+   * Gets the AccessibleContext associated with this <code>List</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTList();
+      }
+    return accessibleContext;
   }
 } // class List
Index: kaffe/libraries/javalib/java/awt/MenuComponent.java
diff -u kaffe/libraries/javalib/java/awt/MenuComponent.java:1.14 kaffe/libraries/javalib/java/awt/MenuComponent.java:1.15
--- kaffe/libraries/javalib/java/awt/MenuComponent.java:1.14	Mon Oct  4 09:01:30 2004
+++ kaffe/libraries/javalib/java/awt/MenuComponent.java	Wed Jan  5 20:16:26 2005
@@ -130,7 +130,7 @@
    * @see #getAccessibleContext()
    * @serial the accessibility information for this component.
    */
-  private AccessibleContext accessibleContext;
+  AccessibleContext accessibleContext;
 
   /**
    * Was the name of the component set?  This value defaults
Index: kaffe/libraries/javalib/java/awt/MenuItem.java
diff -u kaffe/libraries/javalib/java/awt/MenuItem.java:1.16 kaffe/libraries/javalib/java/awt/MenuItem.java:1.17
--- kaffe/libraries/javalib/java/awt/MenuItem.java:1.16	Sun Dec 12 01:35:09 2004
+++ kaffe/libraries/javalib/java/awt/MenuItem.java	Wed Jan  5 20:16:26 2005
@@ -47,6 +47,7 @@
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleContext;
 import javax.accessibility.AccessibleRole;
 import javax.accessibility.AccessibleValue;
 
@@ -579,7 +580,21 @@
 	  ",actionCommand=" + actionCommand + "," + super.paramString());
 }
 
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+/**
+ * Gets the AccessibleContext associated with this <code>MenuItem</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+public AccessibleContext getAccessibleContext()
+{
+  /* Create the context if this is the first request */
+  if (accessibleContext == null)
+    {
+      /* Create the context */
+      accessibleContext = new AccessibleAWTMenuItem();
+    }
+  return accessibleContext;
+}
 
 } // class MenuItem 
Index: kaffe/libraries/javalib/java/awt/ScrollPane.java
diff -u kaffe/libraries/javalib/java/awt/ScrollPane.java:1.17 kaffe/libraries/javalib/java/awt/ScrollPane.java:1.18
--- kaffe/libraries/javalib/java/awt/ScrollPane.java:1.17	Mon Oct  4 09:01:32 2004
+++ kaffe/libraries/javalib/java/awt/ScrollPane.java	Wed Jan  5 20:16:27 2005
@@ -43,6 +43,8 @@
 import java.awt.peer.ScrollPanePeer;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
 
 /**
   * This widget provides a scrollable region that allows a single 
@@ -586,6 +588,31 @@
   public void setWheelScrollingEnabled (boolean enable)
   {
     wheelScrollingEnabled = enable;
+  }
+  
+  protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.SCROLL_PANE;
+    }
+  }
+
+  /**
+   * Gets the AccessibleContext associated with this <code>Scrollbar</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTScrollPane();
+      }
+    return accessibleContext;
   }
 } // class ScrollPane 
 
Index: kaffe/libraries/javalib/java/awt/Scrollbar.java
diff -u kaffe/libraries/javalib/java/awt/Scrollbar.java:1.6 kaffe/libraries/javalib/java/awt/Scrollbar.java:1.7
--- kaffe/libraries/javalib/java/awt/Scrollbar.java:1.6	Wed Nov 24 21:49:19 2004
+++ kaffe/libraries/javalib/java/awt/Scrollbar.java	Wed Jan  5 20:16:27 2005
@@ -45,6 +45,12 @@
 import java.util.EventListener;
 
 import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRelation;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleValue;
 
 /**
   * This class implements a scrollbar widget.
@@ -769,5 +775,82 @@
   {
     return next_scrollbar_number++;
   }
+  
+  protected class AccessibleAWTScrollbar extends AccessibleAWTComponent
+  	implements AccessibleValue
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.SCROLL_BAR;
+    }
+    
+    public AccessibleStateSet getAccessibleStateSet()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (getOrientation() == HORIZONTAL)
+        states.add(AccessibleState.HORIZONTAL);
+      else
+        states.add(AccessibleState.VERTICAL);
+      if (getValueIsAdjusting())
+        states.add(AccessibleState.BUSY);
+      return states;
+    }
+    
+    public AccessibleValue getAccessibleValue()
+    {
+      return this;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
+     */
+    public Number getCurrentAccessibleValue()
+    {
+      return new Integer(getValue());
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)
+     */
+    public boolean setCurrentAccessibleValue(Number number)
+    {
+      setValue(number.intValue());
+      return true;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()
+     */
+    public Number getMinimumAccessibleValue()
+    {
+      return new Integer(getMinimum());
+    }
+
+    /* (non-Javadoc)
+     * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()
+     */
+    public Number getMaximumAccessibleValue()
+    {
+      return new Integer(getMaximum());
+    }
+  }
+  
+  /**
+   * Gets the AccessibleContext associated with this <code>Scrollbar</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
+  public AccessibleContext getAccessibleContext()
+  {
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTScrollbar();
+      }
+    return accessibleContext;
+  }
+
 } // class Scrollbar 
 
Index: kaffe/libraries/javalib/java/awt/Window.java
diff -u kaffe/libraries/javalib/java/awt/Window.java:1.25 kaffe/libraries/javalib/java/awt/Window.java:1.26
--- kaffe/libraries/javalib/java/awt/Window.java:1.25	Sat Dec 11 23:08:40 2004
+++ kaffe/libraries/javalib/java/awt/Window.java	Wed Jan  5 20:16:27 2005
@@ -56,6 +56,9 @@
 
 import javax.accessibility.Accessible;
 import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 
 /**
  * This class represents a top-level window with no decorations.
@@ -84,11 +87,26 @@
   private transient WindowFocusListener windowFocusListener;
   private transient WindowStateListener windowStateListener;
   private transient GraphicsConfiguration graphicsConfiguration;
-  private transient AccessibleContext accessibleContext;
 
   private transient boolean shown;
 
   private transient Component windowFocusOwner;
+  
+  protected class AccessibleAWTWindow extends AccessibleAWTContainer
+  {
+    public AccessibleRole getAccessibleRole()
+    {
+      return AccessibleRole.WINDOW;
+    }
+    
+    public AccessibleStateSet getAccessibleState()
+    {
+      AccessibleStateSet states = super.getAccessibleStateSet();
+      if (isActive())
+        states.add(AccessibleState.ACTIVE);
+      return states;
+    }
+  }
 
   /** 
    * This (package access) constructor is used by subclasses that want
@@ -672,8 +690,34 @@
 	  }
       }
   }
+  
+  /**
+   * Identifies if this window is active.  The active window is a Frame or
+   * Dialog that has focus or owns the active window.
+   *  
+   * @return true if active, else false.
+   * @since 1.4
+   */
+  public boolean isActive()
+  {
+    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+    return manager.getActiveWindow() == this;
+  }
 
   /**
+   * Identifies if this window is focused.  A window is focused if it is the
+   * focus owner or it contains the focus owner.
+   * 
+   * @return true if focused, else false.
+   * @since 1.4
+   */
+  public boolean isFocused()
+  {
+    KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+    return manager.getFocusedWindow() == this;
+  }
+  
+  /**
    * Returns the child window that has focus if this window is active.
    * This method returns <code>null</code> if this window is not active
    * or no children have focus.
@@ -770,11 +814,21 @@
       applyResourceBundle(rb);    
   }
 
+  /**
+   * Gets the AccessibleContext associated with this <code>Window</code>.
+   * The context is created, if necessary.
+   *
+   * @return the associated context
+   */
   public AccessibleContext getAccessibleContext()
   {
-    // FIXME
-    //return null;
-    throw new Error ("Not implemented");
+    /* Create the context if this is the first request */
+    if (accessibleContext == null)
+      {
+        /* Create the context */
+        accessibleContext = new AccessibleAWTWindow();
+      }
+    return accessibleContext;
   }
 
   /** 




More information about the kaffe mailing list