/[classpath]/classpath/javax/swing/plaf/basic/BasicTableUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicTableUI.java

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

revision 1.27 by rabbit78, Wed Sep 28 15:31:47 2005 UTC revision 1.28 by rabbit78, Thu Sep 29 22:53:52 2005 UTC
# Line 76  import javax.swing.table.TableCellRender Line 76  import javax.swing.table.TableCellRender
76  import javax.swing.table.TableColumn;  import javax.swing.table.TableColumn;
77  import javax.swing.table.TableColumnModel;  import javax.swing.table.TableColumnModel;
78    
79  public class BasicTableUI  public class BasicTableUI extends TableUI
   extends TableUI  
80  {  {
81    public static ComponentUI createUI(JComponent comp)    public static ComponentUI createUI(JComponent comp)
82    {    {
# Line 99  public class BasicTableUI Line 98  public class BasicTableUI
98    /** The action bound to KeyStrokes. */    /** The action bound to KeyStrokes. */
99    TableAction action;    TableAction action;
100    
101      /**
102       * Handles key events for the JTable. Key events should be handled through
103       * the InputMap/ActionMap mechanism since JDK1.3. This class is only there
104       * for backwards compatibility.
105       *
106       * @author Roman Kennke (kennke@aicas.com)
107       */
108      public class KeyHandler implements KeyListener
109      {
110    
111        /**
112         * Receives notification that a key has been pressed and released.
113         *
114         * @param event the key event
115         */
116        public void keyTyped(KeyEvent event)
117        {
118          // Key events should be handled through the InputMap/ActionMap mechanism
119          // since JDK1.3. This class is only there for backwards compatibility.
120        }
121    
122        /**
123         * Receives notification that a key has been pressed.
124         *
125         * @param event the key event
126         */
127        public void keyPressed(KeyEvent event)
128        {
129          // Key events should be handled through the InputMap/ActionMap mechanism
130          // since JDK1.3. This class is only there for backwards compatibility.
131        }
132    
133        /**
134         * Receives notification that a key has been released.
135         *
136         * @param event the key event
137         */
138        public void keyReleased(KeyEvent event)
139        {
140          // Key events should be handled through the InputMap/ActionMap mechanism
141          // since JDK1.3. This class is only there for backwards compatibility.
142        }
143      }
144    
145    public class FocusHandler implements FocusListener    public class FocusHandler implements FocusListener
146    {    {
147      public void focusGained(FocusEvent e)      public void focusGained(FocusEvent e)
# Line 206  public class BasicTableUI Line 249  public class BasicTableUI
249      return new MouseInputHandler();      return new MouseInputHandler();
250    }    }
251    
252    
253      /**
254       * Creates and returns a key listener for the JTable.
255       *
256       * @return a key listener for the JTable
257       */
258      protected KeyListener createKeyListener()
259      {
260        return new KeyHandler();
261      }
262    
263    /**    /**
264     * Return the maximum size of the table. The maximum height is the row     * Return the maximum size of the table. The maximum height is the row
265      * height times the number of rows. The maximum width is the sum of      * height times the number of rows. The maximum width is the sum of
# Line 922  public class BasicTableUI Line 976  public class BasicTableUI
976    
977    protected void installListeners()    protected void installListeners()
978    {    {
979      table.addFocusListener(focusListener);        if (focusListener == null)
980          focusListener = createFocusListener();
981        table.addFocusListener(focusListener);
982        if (keyListener == null)
983          keyListener = createKeyListener();
984      table.addKeyListener(keyListener);      table.addKeyListener(keyListener);
985        if (mouseInputListener == null)
986          mouseInputListener = createMouseInputListener();
987      table.addMouseListener(mouseInputListener);          table.addMouseListener(mouseInputListener);    
988      table.addMouseMotionListener(mouseInputListener);      table.addMouseMotionListener(mouseInputListener);
989    }    }
# Line 963  public class BasicTableUI Line 1023  public class BasicTableUI
1023    public void installUI(JComponent comp)    public void installUI(JComponent comp)
1024    {    {
1025      table = (JTable)comp;      table = (JTable)comp;
     focusListener = createFocusListener();    
     mouseInputListener = createMouseInputListener();  
1026      installDefaults();      installDefaults();
1027      installKeyboardActions();      installKeyboardActions();
1028      installListeners();      installListeners();

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28

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