/** {@inheritDoc} */ @Override protected void uninstallListeners(JComponent c) { super.uninstallListeners(c); c.removePropertyChangeListener(this); if (viewportViewFocusHandler != null) { JViewport viewport = ((JScrollPane) c).getViewport(); viewport.removeContainerListener(viewportViewFocusHandler); if (viewport.getView() != null) { viewport.getView().removeFocusListener(viewportViewFocusHandler); } viewportViewFocusHandler = null; } }
/** {@inheritDoc} */ @Override protected void installListeners(JScrollPane c) { super.installListeners(c); c.addPropertyChangeListener(this); if (UIManager.getBoolean("ScrollPane.useChildTextComponentFocus")) { viewportViewFocusHandler = new ViewportViewFocusHandler(); c.getViewport().addContainerListener(viewportViewFocusHandler); Component view = c.getViewport().getView(); if (view instanceof JTextComponent) { view.addFocusListener(viewportViewFocusHandler); } } }