Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jpicedt/ui/util/DebugFocusManager.java


1   /*
2    DebugFocusManager.java - January 1, 2002 - jPicEdt 1.3.2, a picture editor for LaTeX.
3    Copyright (C) 1999-2002 Sylvain Reynal
4   
5    Département de Physique
6    Ecole Nationale Supérieure de l'Electronique et de ses Applications (ENSEA)
7    6, avenue du Ponceau
8    F-95014 CERGY CEDEX
9   
10   Tel : +33 130 736 245
11   Fax : +33 130 736 667
12   e-mail : reynal@ensea.fr
13   jPicEdt web page : http://www.jpicedt.org
14    
15   This program is free software; you can redistribute it and/or
16   modify it under the terms of the GNU General Public License
17   as published by the Free Software Foundation; either version 2
18   of the License, or any later version.
19    
20   This program is distributed in the hope that it will be useful,
21   but WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23   GNU General Public License for more details.
24    
25   You should have received a copy of the GNU General Public License
26   along with this program; if not, write to the Free Software
27   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28   */
29  
30  package jpicedt.ui.util;
31  
32  import java.awt.*;
33  import java.awt.event.*;
34  import javax.swing.*;
35  
36  /**
37   * A subclass of Swing's DefaultFocusManager that aims at helping us debug FocusEvent related bugs<p>
38   * To set this class as Swing's FocusManager, just say :<br>
39   * <code>FocusManager.setCurrentManager(an_instance_of_DebugFocusManager);</code>
40   *  
41   * @since jPicEdt 1.3.2
42   * @author Sylvain Reynal
43   */
44  public class DebugFocusManager extends DefaultFocusManager  {
45  
46  
47    /**
48     * Cause the focus manager to set the focus on the next focusable component<p>
49     * Overriden so as to display information about the component.
50     * @since jPicEdt 1.3.2
51     * @author Sylvain Reynal
52     */
53    public void focusNextComponent(Component c){
54      
55      System.out.println("DebugFocusManager.focusNextComponent : " + c);
56      super.focusNextComponent(c);
57    }
58    
59    /**
60     * Cause the focus manager to set the focus on the previous focusable component<p>
61     * Overriden so as to display information about the component.
62     * @since jPicEdt 1.3.2
63     * @author Sylvain Reynal
64     */
65    public void focusPreviousComponent(Component c){
66      
67      System.out.println("DebugFocusManager.focusPreviousComponent : " + c);
68      super.focusPreviousComponent(c);
69    }
70    
71    /**
72     * Called by a JComponent when a key event occus.<p>
73     * Overriden so as to display information about the component.
74     * @param c the focused component
75     * @param ke the key event
76     * @since jPicEdt 1.3.2
77     * @author Sylvain Reynal
78     */
79    public void processKeyEvent(Component c, KeyEvent ke){
80      
81      System.out.println("DebugFocusManager.processKeyEvent : " + ke + " on component " + c);
82      super.processKeyEvent(c,ke);
83    }
84  
85    
86  } // class 
87