Java Code Examples for java.awt.Component#removeFocusListener()

The following examples show how to use java.awt.Component#removeFocusListener() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: FlatLaf   File: FlatScrollPaneUI.java    License: Apache License 2.0 5 votes vote down vote up
private void removeViewportListeners( JViewport viewport ) {
	if( viewport == null )
		return;

	viewport.removeContainerListener( getHandler() );

	Component view = viewport.getView();
	if( view != null )
		view.removeFocusListener( getHandler() );
}
 
Example 2
public void uninstallListeners() {
  if (dockingListener != null) {
    lizziePane.removeMouseMotionListener(dockingListener);
    lizziePane.removeMouseListener(dockingListener);

    dockingListener = null;
  }

  if (propertyListener != null) {
    lizziePane.removePropertyChangeListener(propertyListener);
    propertyListener = null; // removed in setFloating
  }

  if (lizziePaneContListener != null) {
    lizziePane.removeContainerListener(lizziePaneContListener);
    lizziePaneContListener = null;
  }

  if (lizziePaneFocusListener != null) {
    // Remove focus listener from all components in lizziePane
    Component[] components = lizziePane.getComponents();

    for (Component component : components) {
      component.removeFocusListener(lizziePaneFocusListener);
    }

    lizziePaneFocusListener = null;
  }
  handler = null;
}
 
Example 3
public void componentRemoved(ContainerEvent evt) {
  Component c = evt.getChild();

  if (lizziePaneFocusListener != null) {
    c.removeFocusListener(lizziePaneFocusListener);
  }
}
 
Example 4
Source Project: netbeans   File: UIUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static void keepFocusedComponentVisible(Component component, FocusListener l) {
    component.removeFocusListener(l); // Making sure that it is not added twice
    component.addFocusListener(l);
    if (component instanceof Container) {
        for (Component subComponent : ((Container)component).getComponents()) {
            keepFocusedComponentVisible(subComponent, l);
        }
    }
}
 
Example 5
public void removeItem(Component c) {
    if (toolbar != null) {
        toolbar.remove(c);
    } else {
        if (c instanceof AbstractButton) {
            c.removeMouseListener(listener);
            ((AbstractButton) c).removeChangeListener(listener);
            c.removeFocusListener(listener);
        }
        remove(c);
    }
    repaint();
}
 
Example 6
Source Project: pumpernickel   File: SplayedLayout.java    License: MIT License 5 votes vote down vote up
@Override
public void focusGained(FocusEvent e) {
	Component c = e.getComponent();
	Container splayedAncestor = getSplayedAncestor(c);
	if (splayedAncestor == null) {
		c.removeFocusListener(this);
	} else if (prioritizeFocus) {
		splayedAncestor.revalidate();
	}
}
 
Example 7
Source Project: beautyeye   File: BEToolBarUI.java    License: Apache License 2.0 5 votes vote down vote up
public void componentRemoved(ContainerEvent evt) {
    Component c = evt.getChild();

    if (toolBarFocusListener != null) {
        c.removeFocusListener(toolBarFocusListener);
    }

    // Revert the button border
    setBorderToNormal(c);
}
 
Example 8
Source Project: pdfxtk   File: JWindowToolBarUI.java    License: Apache License 2.0 5 votes vote down vote up
public void componentRemoved( ContainerEvent e )
   {
     Component c = e.getChild();

     if ( toolBarFocusListener != null )
{
  c.removeFocusListener( toolBarFocusListener );
}
   }