Java Swing Focus setFocusOn(Component component)

Here you can find the source of setFocusOn(Component component)

Description

set Focus On

License

Apache License

Declaration

public static final void setFocusOn(Component component) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.awt.Component;

import javax.swing.SwingUtilities;

public class Main {
    public static final void setFocusOn(Component component) {
        final Component reference = component;
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                reference.requestFocus();
            }//ww  w.  j a  v a  2 s. c  om
        });
    }
}

Related

  1. requestFocusInWindow(final Component c)
  2. selectAllOnFocusGained()
  3. selectAndFocus(JComponent component)
  4. setFocus(JComponent component)
  5. setFocusableRecursively(final JComponent component, final boolean focusable, final boolean childsOnly)
  6. setFocusOrder(JComponent... components)
  7. setNextFocusable(JComponent component, final JComponent nextFocusable)
  8. smartRequestFocus(Component component)