/[classpath]/classpath/javax/swing/JComponent.java
ViewVC logotype

Diff of /classpath/javax/swing/JComponent.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20.2.12 by gnu_andrew, Tue Aug 2 20:12:37 2005 UTC revision 1.20.2.13 by gnu_andrew, Sat Sep 10 15:31:48 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing;  package javax.swing;
40    
41    import java.applet.Applet;
42  import java.awt.AWTEvent;  import java.awt.AWTEvent;
43  import java.awt.Color;  import java.awt.Color;
44  import java.awt.Component;  import java.awt.Component;
# Line 52  import java.awt.Image; Line 53  import java.awt.Image;
53  import java.awt.Insets;  import java.awt.Insets;
54  import java.awt.Point;  import java.awt.Point;
55  import java.awt.Rectangle;  import java.awt.Rectangle;
56    import java.awt.Window;
57  import java.awt.dnd.DropTarget;  import java.awt.dnd.DropTarget;
58  import java.awt.event.ActionEvent;  import java.awt.event.ActionEvent;
59  import java.awt.event.ActionListener;  import java.awt.event.ActionListener;
# Line 1811  public abstract class JComponent extends Line 1813  public abstract class JComponent extends
1813      super.processKeyEvent(e);      super.processKeyEvent(e);
1814      processComponentKeyEvent(e);      processComponentKeyEvent(e);
1815    
1816      // FIXME: this needs to be elaborated significantly, to do all the      if (e.isConsumed())
1817      // focus / ancestor / window searching for the various binding modes.        return;
1818      if (! e.isConsumed() &&  
1819          processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),      // Input maps are checked in this order:
1820        // 1. The focused component's WHEN_FOCUSED map is checked.
1821        // 2. The focused component's WHEN_ANCESTOR_OF_FOCUSED_COMPONENT map.
1822        // 3. The WHEN_ANCESTOR_OF_FOCUSED_COMPONENT maps of the focused
1823        //    component's parent, then its parent's parent, and so on.
1824        //    Note: Input maps for disabled components are skipped.
1825        // 4. The WHEN_IN_FOCUSED_WINDOW maps of all the enabled components in
1826        //    the focused window are searched.
1827        
1828        if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
1829                            e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))                            e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))
1830          // This is step 1 from above comment.
1831          e.consume();
1832        else if (processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
1833                                   e, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
1834                                   e.getID() == KeyEvent.KEY_PRESSED))
1835          // This is step 2 from above comment.
1836        e.consume();        e.consume();
1837        else
1838          {
1839            // This is step 3 from above comment.
1840            Container current = this;
1841            while ((current = current.getParent()) instanceof JComponent)
1842              {
1843                if (((JComponent)current).processKeyBinding
1844                    (KeyStroke.getKeyStrokeForEvent(e), e,
1845                     WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
1846                     e.getID() == KeyEvent.KEY_PRESSED))
1847                  {
1848                    e.consume();
1849                    break;
1850                  }
1851                if (current instanceof Window || current instanceof Applet
1852                    || current instanceof JInternalFrame)
1853                  break;
1854              }
1855            if (e.isConsumed())
1856              return;
1857            
1858            // This is step 4 from above comment.
1859            // FIXME: Implement.  Note, should use ComponentInputMaps rather
1860            // than walking the entire containment hierarchy.
1861          }
1862    }    }
1863    
1864    protected boolean processKeyBinding(KeyStroke ks,    protected boolean processKeyBinding(KeyStroke ks,

Legend:
Removed from v.1.20.2.12  
changed lines
  Added in v.1.20.2.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26