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

The following examples show how to use java.awt.Component#removeFocusListener() . 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 File: FlatScrollPaneUI.java    From FlatLaf with 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
Source File: BasicLizziePaneUI.java    From lizzie with GNU General Public License v3.0 5 votes vote down vote up
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
Source File: BasicLizziePaneUI.java    From lizzie with GNU General Public License v3.0 5 votes vote down vote up
public void componentRemoved(ContainerEvent evt) {
  Component c = evt.getChild();

  if (lizziePaneFocusListener != null) {
    c.removeFocusListener(lizziePaneFocusListener);
  }
}
 
Example 4
Source File: UIUtils.java    From netbeans with 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
Source File: TransparentToolBar.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
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 File: SplayedLayout.java    From pumpernickel with 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 File: BEToolBarUI.java    From beautyeye with 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 File: JWindowToolBarUI.java    From pdfxtk with 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 );
}
   }