1549 }
1550
1551 private Handler getHandler() {
1552 if (handler == null) {
1553 handler = new Handler();
1554 }
1555 return handler;
1556 }
1557
1558 /**
1559 * Mouse input, and focus handling for JList. An instance of this
1560 * class is added to the appropriate java.awt.Component lists
1561 * at installUI() time. Note keyboard input is handled with JComponent
1562 * KeyboardActions, see installKeyboardActions().
1563 * <p>
1564 * <strong>Warning:</strong>
1565 * Serialized objects of this class will not be compatible with
1566 * future Swing releases. The current serialization support is
1567 * appropriate for short term storage or RMI between applications running
1568 * the same version of Swing. As of 1.4, support for long term storage
1569 * of all JavaBeans™
1570 * has been added to the <code>java.beans</code> package.
1571 * Please see {@link java.beans.XMLEncoder}.
1572 *
1573 * @see #createMouseInputListener
1574 * @see #installKeyboardActions
1575 * @see #installUI
1576 */
1577 @SuppressWarnings("serial") // Same-version serialization only
1578 public class MouseInputHandler implements MouseInputListener
1579 {
1580 public void mouseClicked(MouseEvent e) {
1581 getHandler().mouseClicked(e);
1582 }
1583
1584 public void mouseEntered(MouseEvent e) {
1585 getHandler().mouseEntered(e);
1586 }
1587
1588 public void mouseExited(MouseEvent e) {
1589 getHandler().mouseExited(e);
1663
1664 /**
1665 * Returns an instance of {@code FocusListener}.
1666 *
1667 * @return an instance of {@code FocusListener}
1668 */
1669 protected FocusListener createFocusListener() {
1670 return getHandler();
1671 }
1672
1673 /**
1674 * The ListSelectionListener that's added to the JLists selection
1675 * model at installUI time, and whenever the JList.selectionModel property
1676 * changes. When the selection changes we repaint the affected rows.
1677 * <p>
1678 * <strong>Warning:</strong>
1679 * Serialized objects of this class will not be compatible with
1680 * future Swing releases. The current serialization support is
1681 * appropriate for short term storage or RMI between applications running
1682 * the same version of Swing. As of 1.4, support for long term storage
1683 * of all JavaBeans™
1684 * has been added to the <code>java.beans</code> package.
1685 * Please see {@link java.beans.XMLEncoder}.
1686 *
1687 * @see #createListSelectionListener
1688 * @see #getCellBounds
1689 * @see #installUI
1690 */
1691 @SuppressWarnings("serial") // Same-version serialization only
1692 public class ListSelectionHandler implements ListSelectionListener
1693 {
1694 public void valueChanged(ListSelectionEvent e)
1695 {
1696 getHandler().valueChanged(e);
1697 }
1698 }
1699
1700
1701 /**
1702 * Creates an instance of {@code ListSelectionHandler} that's added to
1703 * the {@code JLists} by selectionModel as needed. Subclasses can override
1723 protected ListSelectionListener createListSelectionListener() {
1724 return getHandler();
1725 }
1726
1727
1728 private void redrawList() {
1729 list.revalidate();
1730 list.repaint();
1731 }
1732
1733
1734 /**
1735 * The {@code ListDataListener} that's added to the {@code JLists} model at
1736 * {@code installUI time}, and whenever the JList.model property changes.
1737 * <p>
1738 * <strong>Warning:</strong>
1739 * Serialized objects of this class will not be compatible with
1740 * future Swing releases. The current serialization support is
1741 * appropriate for short term storage or RMI between applications running
1742 * the same version of Swing. As of 1.4, support for long term storage
1743 * of all JavaBeans™
1744 * has been added to the <code>java.beans</code> package.
1745 * Please see {@link java.beans.XMLEncoder}.
1746 *
1747 * @see JList#getModel
1748 * @see #maybeUpdateLayoutState
1749 * @see #createListDataListener
1750 * @see #installUI
1751 */
1752 @SuppressWarnings("serial") // Same-version serialization only
1753 public class ListDataHandler implements ListDataListener
1754 {
1755 public void intervalAdded(ListDataEvent e) {
1756 getHandler().intervalAdded(e);
1757 }
1758
1759
1760 public void intervalRemoved(ListDataEvent e)
1761 {
1762 getHandler().intervalRemoved(e);
1763 }
1792 * @see JList#getModel
1793 * @see #installUI
1794 */
1795 protected ListDataListener createListDataListener() {
1796 return getHandler();
1797 }
1798
1799
1800 /**
1801 * The PropertyChangeListener that's added to the JList at
1802 * installUI time. When the value of a JList property that
1803 * affects layout changes, we set a bit in updateLayoutStateNeeded.
1804 * If the JLists model changes we additionally remove our listeners
1805 * from the old model. Likewise for the JList selectionModel.
1806 * <p>
1807 * <strong>Warning:</strong>
1808 * Serialized objects of this class will not be compatible with
1809 * future Swing releases. The current serialization support is
1810 * appropriate for short term storage or RMI between applications running
1811 * the same version of Swing. As of 1.4, support for long term storage
1812 * of all JavaBeans™
1813 * has been added to the <code>java.beans</code> package.
1814 * Please see {@link java.beans.XMLEncoder}.
1815 *
1816 * @see #maybeUpdateLayoutState
1817 * @see #createPropertyChangeListener
1818 * @see #installUI
1819 */
1820 @SuppressWarnings("serial") // Same-version serialization only
1821 public class PropertyChangeHandler implements PropertyChangeListener
1822 {
1823 public void propertyChange(PropertyChangeEvent e)
1824 {
1825 getHandler().propertyChange(e);
1826 }
1827 }
1828
1829
1830 /**
1831 * Creates an instance of {@code PropertyChangeHandler} that's added to
1832 * the {@code JList} by {@code installUI()}. Subclasses can override this method
|
1549 }
1550
1551 private Handler getHandler() {
1552 if (handler == null) {
1553 handler = new Handler();
1554 }
1555 return handler;
1556 }
1557
1558 /**
1559 * Mouse input, and focus handling for JList. An instance of this
1560 * class is added to the appropriate java.awt.Component lists
1561 * at installUI() time. Note keyboard input is handled with JComponent
1562 * KeyboardActions, see installKeyboardActions().
1563 * <p>
1564 * <strong>Warning:</strong>
1565 * Serialized objects of this class will not be compatible with
1566 * future Swing releases. The current serialization support is
1567 * appropriate for short term storage or RMI between applications running
1568 * the same version of Swing. As of 1.4, support for long term storage
1569 * of all JavaBeans
1570 * has been added to the <code>java.beans</code> package.
1571 * Please see {@link java.beans.XMLEncoder}.
1572 *
1573 * @see #createMouseInputListener
1574 * @see #installKeyboardActions
1575 * @see #installUI
1576 */
1577 @SuppressWarnings("serial") // Same-version serialization only
1578 public class MouseInputHandler implements MouseInputListener
1579 {
1580 public void mouseClicked(MouseEvent e) {
1581 getHandler().mouseClicked(e);
1582 }
1583
1584 public void mouseEntered(MouseEvent e) {
1585 getHandler().mouseEntered(e);
1586 }
1587
1588 public void mouseExited(MouseEvent e) {
1589 getHandler().mouseExited(e);
1663
1664 /**
1665 * Returns an instance of {@code FocusListener}.
1666 *
1667 * @return an instance of {@code FocusListener}
1668 */
1669 protected FocusListener createFocusListener() {
1670 return getHandler();
1671 }
1672
1673 /**
1674 * The ListSelectionListener that's added to the JLists selection
1675 * model at installUI time, and whenever the JList.selectionModel property
1676 * changes. When the selection changes we repaint the affected rows.
1677 * <p>
1678 * <strong>Warning:</strong>
1679 * Serialized objects of this class will not be compatible with
1680 * future Swing releases. The current serialization support is
1681 * appropriate for short term storage or RMI between applications running
1682 * the same version of Swing. As of 1.4, support for long term storage
1683 * of all JavaBeans
1684 * has been added to the <code>java.beans</code> package.
1685 * Please see {@link java.beans.XMLEncoder}.
1686 *
1687 * @see #createListSelectionListener
1688 * @see #getCellBounds
1689 * @see #installUI
1690 */
1691 @SuppressWarnings("serial") // Same-version serialization only
1692 public class ListSelectionHandler implements ListSelectionListener
1693 {
1694 public void valueChanged(ListSelectionEvent e)
1695 {
1696 getHandler().valueChanged(e);
1697 }
1698 }
1699
1700
1701 /**
1702 * Creates an instance of {@code ListSelectionHandler} that's added to
1703 * the {@code JLists} by selectionModel as needed. Subclasses can override
1723 protected ListSelectionListener createListSelectionListener() {
1724 return getHandler();
1725 }
1726
1727
1728 private void redrawList() {
1729 list.revalidate();
1730 list.repaint();
1731 }
1732
1733
1734 /**
1735 * The {@code ListDataListener} that's added to the {@code JLists} model at
1736 * {@code installUI time}, and whenever the JList.model property changes.
1737 * <p>
1738 * <strong>Warning:</strong>
1739 * Serialized objects of this class will not be compatible with
1740 * future Swing releases. The current serialization support is
1741 * appropriate for short term storage or RMI between applications running
1742 * the same version of Swing. As of 1.4, support for long term storage
1743 * of all JavaBeans
1744 * has been added to the <code>java.beans</code> package.
1745 * Please see {@link java.beans.XMLEncoder}.
1746 *
1747 * @see JList#getModel
1748 * @see #maybeUpdateLayoutState
1749 * @see #createListDataListener
1750 * @see #installUI
1751 */
1752 @SuppressWarnings("serial") // Same-version serialization only
1753 public class ListDataHandler implements ListDataListener
1754 {
1755 public void intervalAdded(ListDataEvent e) {
1756 getHandler().intervalAdded(e);
1757 }
1758
1759
1760 public void intervalRemoved(ListDataEvent e)
1761 {
1762 getHandler().intervalRemoved(e);
1763 }
1792 * @see JList#getModel
1793 * @see #installUI
1794 */
1795 protected ListDataListener createListDataListener() {
1796 return getHandler();
1797 }
1798
1799
1800 /**
1801 * The PropertyChangeListener that's added to the JList at
1802 * installUI time. When the value of a JList property that
1803 * affects layout changes, we set a bit in updateLayoutStateNeeded.
1804 * If the JLists model changes we additionally remove our listeners
1805 * from the old model. Likewise for the JList selectionModel.
1806 * <p>
1807 * <strong>Warning:</strong>
1808 * Serialized objects of this class will not be compatible with
1809 * future Swing releases. The current serialization support is
1810 * appropriate for short term storage or RMI between applications running
1811 * the same version of Swing. As of 1.4, support for long term storage
1812 * of all JavaBeans
1813 * has been added to the <code>java.beans</code> package.
1814 * Please see {@link java.beans.XMLEncoder}.
1815 *
1816 * @see #maybeUpdateLayoutState
1817 * @see #createPropertyChangeListener
1818 * @see #installUI
1819 */
1820 @SuppressWarnings("serial") // Same-version serialization only
1821 public class PropertyChangeHandler implements PropertyChangeListener
1822 {
1823 public void propertyChange(PropertyChangeEvent e)
1824 {
1825 getHandler().propertyChange(e);
1826 }
1827 }
1828
1829
1830 /**
1831 * Creates an instance of {@code PropertyChangeHandler} that's added to
1832 * the {@code JList} by {@code installUI()}. Subclasses can override this method
|