congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Component.requestFocus
Code IndexAdd Tabnine to your IDE (free)

How to use
requestFocus
method
in
java.awt.Component

Best Java code snippets using java.awt.Component.requestFocus (Showing top 20 results out of 846)

origin: igniterealtime/Openfire

/**
 * Puts the focus on the first component in the tree of <code>c</code> that
 * can accept the focus.
 *
 * @param c       the root of the component hierarchy to search
 * @param deepest if <code>deepest</code> is true the method will focus the first and deepest component that can
 *                accept the focus.
 *                For example, if both a child and its parent are focusable and <code>deepest</code> is true, the child is focused.
 * @see #getFocusableComponentOrChild
 */
public static Component focusComponentOrChild(Component c, boolean deepest) {
  final Component focusable = getFocusableComponentOrChild(c, deepest);
  if (focusable != null) {
    focusable.requestFocus();
  }
  return focusable;
}
origin: nodebox/nodebox

public void focusGained(FocusEvent focusEvent) {
  if (mainComponent != null) {
    mainComponent.requestFocus();
  }
}
origin: 4thline/cling

  @Override
  public void actionPerformed(ActionEvent actionEvent) {
    int column;
    int row;
    if ((column = getEditingColumn()) != -1 && (row = getEditingRow()) != -1) {
      if (forward) {
        if (getEditingRow() < getRowCount()) {
          editCellAt(row + 1, column);
        }
      } else {
        if (getEditingRow() > 0) {
          editCellAt(row -1, column);
        }
      }
      if (getEditorComponent() != null)
        getEditorComponent().requestFocus();
    }
  }
}
origin: org.netbeans.api/org-openide-awt

@Override
public void requestFocus() {
  if (browserComponent != null) {
    boolean ownerFound = false;
    if (browserComponent instanceof JComponent) {
      ownerFound = ((JComponent) browserComponent).requestDefaultFocus();
    }
    if (!ownerFound) {
      browserComponent.requestFocus();
    }
  } else {
    super.requestFocus();
  }
}
origin: org.netbeans.api/org-openide-dialogs

/** Overriden to delegate call to user component.
 */
@Override
public void requestFocus() {
  if ((rightComponent != null) && rightComponent.isDisplayable()) {
    JComponent comp = (JComponent) rightComponent;
    Container rootAnc = comp.getFocusCycleRootAncestor();
    FocusTraversalPolicy policy = rootAnc.getFocusTraversalPolicy();
    Component focus = policy.getComponentAfter(rootAnc, comp);
    if (focus != null) {
      focus.requestFocus();
    } else {
      comp.requestFocus();
    }
  } else {
    super.requestFocus();
  }
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 *
 */
public void run() {
  if (editorComp != null && editorComp.isShowing()) {
    editorComp.requestFocus();
  }
}
origin: org.netbeans.api/org-openide-explorer

/**
 *
 */
public void run() {
  if ((editorComp != null) && editorComp.isShowing()) {
    editorComp.requestFocus();
  }
}
origin: freeplane/freeplane

  @Override
  public void run() {
    if (getMapView() != null) {
      final Component selectedComponent = getSelectedComponent();
      if(selectedComponent != null){
        selectedComponent.requestFocus();
      }
    }
  }
});
origin: mucommander/mucommander

  public void focusGained(FocusEvent e) {
    // Delegate the focus to the JComponent that actually present the file
    Component component = FilePresenter.this.getViewport().getComponent(0);
    if (component != null)
      component.requestFocus();
  }
});
origin: com.b3dgs.lionengine/lionengine-core-awt

/**
 * Link keyboard to the screen (listening to).
 * 
 * @param keyboard The keyboard reference.
 */
private void addKeyboardListener(KeyboardAwt keyboard)
{
  componentForKeyboard.addKeyListener(keyboard);
  componentForKeyboard.requestFocus();
  componentForKeyboard.setFocusTraversalKeysEnabled(false);
}
origin: org.netbeans.api/org-openide-explorer

/** Transfers focus to the table */
public void requestFocus() {
  JScrollPane jsc = findScrollPane();
  if ((jsc != null) && (jsc.getViewport().getView() != null)) {
    jsc.getViewport().getView().requestFocus();
  }
}
origin: com.synaptix/SynaptixSwing

public void requestFocus() {
  AccessibleContext ac = getCurrentAccessibleContext();
  if (ac instanceof AccessibleComponent) {
    ((AccessibleComponent) ac).requestFocus();
  } else {
    Component c = getCurrentComponent();
    if (c != null) {
      c.requestFocus();
    }
  }
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Transfer the focus to the editor pane.
 */
public void requestFocus() {
  super.requestFocus ();
  if(customComponent != null
  && !SwingUtilities.isDescendingFrom(pane, customComponent)) {
    customComponent.requestFocus();
  } else if(pane != null) {
    pane.requestFocus();
  }
}

origin: org.netbeans.api/org-openide-explorer

/** Initiate editing automatically - triggered by the focus event countdown */
private void autoEdit() {
  editCellAt(getSelectedRow(), getSelectedColumn(), null);
  if (editorComp != null) {
    editorComp.requestFocus();
  }
  countDown = -1;
}
origin: freeplane/freeplane

@Override
public void moveFocusFromDescendantToSelection(Component ancestor) {
  Component focusOwner = FocusManager.getCurrentManager().getFocusOwner();
  boolean toolbarLostFocus = focusOwner != null && SwingUtilities.isDescendingFrom(focusOwner, ancestor);
  if (toolbarLostFocus) {
    final Component selectedComponent = getSelectedComponent();
    if (selectedComponent != null)
      selectedComponent.requestFocus();
  }
}
origin: org.netbeans.api/org-openide-explorer

protected void processFocusEvent(FocusEvent fe) {
  super.processFocusEvent(fe);
  if (fe.getID() == fe.FOCUS_GAINED) {
    if ((inner != null) && inner.isEnabled() && inner.isFocusTraversable()) {
      inner.requestFocus();
    }
  }
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

protected void processFocusEvent (FocusEvent fe) {
  super.processFocusEvent(fe);
  if (fe.getID() == fe.FOCUS_GAINED) {
    if (inner != null && inner.isEnabled() && inner.isFocusTraversable()) {
      inner.requestFocus();
    }
  }
}
origin: com.haulmont.thirdparty/glazedlists

/**
 * Implementation copied from BasicComboBoxUI.Handler.focusGained.
 */
public void focusGained(FocusEvent e) {
  if (e.getSource() == getEditor().getEditorComponent())
    return;
  repaint();
  if (isEditable() && editor != null)
    getEditor().getEditorComponent().requestFocus();
}
origin: org.netbeans.api/org-openide-explorer

/** Overridden to ensure the editor gets focus if editable */
@Override
public void firePopupMenuCanceled() {
  super.firePopupMenuCanceled();
  if (isEditable()) {
    Component focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (isDisplayable() && (focus == this)) {
      log("combo editor popup menu canceled.  Requesting focus on editor component");
      getEditor().getEditorComponent().requestFocus();
    }
  }
}

origin: freeplane/freeplane

  public void actionPerformed(final ActionEvent arg0) {
    final Controller controller = Controller.getCurrentController();
    final NodeModel nodeModel = controller.getSelection().getSelected();
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component node = viewController.getComponent(nodeModel);
    node.requestFocus();
    final IMapSelection selection = Controller.getCurrentController().getSelection();
    selection.keepNodePosition(nodeModel, 0.0f, 0.0f);
    final MTextController textController = (MTextController) MTextController.getController();
    textController.editDetails(nodeModel, null, useDialog);
  }
}
java.awtComponentrequestFocus

Javadoc

Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, visible, and focusable for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a FOCUS_GAINED event. If this request is denied because this Component's top-level Window cannot become the focused Window, the request will be remembered and will be granted when the Window is later focused by the user.

This method cannot be used to set the focus owner to no Component at all. Use KeyboardFocusManager.clearGlobalFocusOwner() instead.

Because the focus behavior of this method is platform-dependent, developers are strongly encouraged to use requestFocusInWindow when possible.

Popular methods of Component

  • getParent
    Gets the parent of this component.
  • getPreferredSize
    Gets the preferred size of this component.
  • getHeight
    Returns the current height of this component. This method is preferable to writingcomponent.getBound
  • getWidth
    Returns the current width of this component. This method is preferable to writingcomponent.getBounds
  • isVisible
    Determines whether this component should be visible when its parent is visible. Components are initi
  • setBounds
    Moves and resizes this component to conform to the new bounding rectangle r. This component's new po
  • getName
    Gets the name of the component.
  • getSize
    Stores the width/height of this component into "return value" rv and return rv. If rv is null a newD
  • setEnabled
    Enables or disables this component, depending on the value of the parameter b. An enabled component
  • setBackground
    Sets the background color of this component. The background color affects each component differently
  • setVisible
    Shows or hides this component depending on the value of parameterb.
  • getMinimumSize
    Gets the mininimum size of this component.
  • setVisible,
  • getMinimumSize,
  • getBackground,
  • addMouseListener,
  • getBounds,
  • setForeground,
  • repaint,
  • setCursor,
  • setSize

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now