net.wotonomy.ui.swing.components
Class BetterTableUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TableUI
javax.swing.plaf.basic.BasicTableUI
net.wotonomy.ui.swing.components.BetterTableUI
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener
public class BetterTableUI
- extends javax.swing.plaf.basic.BasicTableUI
- implements javax.swing.event.MouseInputListener
BetterTableUI allows a JTable to be disabled by
listening for MouseEvents and then forwarding them
to the usual MouseInputHandler only if the table
is enabled.
This class also works around a bug where an editable
table's selection is changed when clicking in an edit
cell while the control key is down. This typically
happened while users were copying/pasting data from
cell to cell.
To use, call JTable.setUI()
on any
JTable with a BetterTableUI as the parameter.
- Version:
- $Revision: 904 $
- Author:
- michael@mpowers.net
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicTableUI |
javax.swing.plaf.basic.BasicTableUI.FocusHandler, javax.swing.plaf.basic.BasicTableUI.KeyHandler, javax.swing.plaf.basic.BasicTableUI.MouseInputHandler |
Field Summary |
protected javax.swing.event.MouseInputListener |
delegateHandler
The listener to get all mouse events when the table is enabled. |
Fields inherited from class javax.swing.plaf.basic.BasicTableUI |
focusListener, keyListener, mouseInputListener, rendererPane, table |
Methods inherited from class javax.swing.plaf.basic.BasicTableUI |
createFocusListener, createKeyListener, createUI, getMaximumSize, getMinimumSize, getPreferredSize, installDefaults, installKeyboardActions, installListeners, installUI, paint, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI |
Methods inherited from class javax.swing.plaf.ComponentUI |
contains, getAccessibleChild, getAccessibleChildrenCount, update |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
delegateHandler
protected javax.swing.event.MouseInputListener delegateHandler
- The listener to get all mouse events when the table is enabled.
BetterTableUI
public BetterTableUI()
createMouseInputListener
protected javax.swing.event.MouseInputListener createMouseInputListener()
- Overridden to set self as mouse listener and create delegate.
- Overrides:
createMouseInputListener
in class javax.swing.plaf.basic.BasicTableUI
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent event)
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent event)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent event)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent event)
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent event)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent event)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
Copyright © 2006 null. All Rights Reserved.