Java Swing Focus removeFocus(JComponent component)

Here you can find the source of removeFocus(JComponent component)

Description

Makes sure the component won't receive the focus.

License

Open Source License

Parameter

Parameter Description
component the component

Declaration

public static void removeFocus(JComponent component) 

Method Source Code


//package com.java2s;
import javax.swing.*;

public class Main {
    /**//from www. j  a v  a2s  .c o m
     * Makes sure the component won't receive the focus.
     *
     * @param component the component
     */
    public static void removeFocus(JComponent component) {
        component.setRequestFocusEnabled(false);
        component.setFocusable(false);
    }
}

Related

  1. isParentWindowFocused(Component component)
  2. isParentWindowFocused(Component component)
  3. isParentWindowFocused(Component component)
  4. paintFocusRect(Graphics g, Rectangle r)
  5. postponeFocus(final Component target)
  6. requestComponentFocus(final Window win, final JComponent comp)
  7. requestComponentFocus(final Window win, final JComponent comp)
  8. requestFocus(final JComponent comp)
  9. requestFocus(final JComponent comp)