Пример #1
0
 /** {@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;
   }
 }
Пример #2
0
 /** {@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);
     }
   }
 }