Example usage for javax.swing JComponent isRequestFocusEnabled

List of usage examples for javax.swing JComponent isRequestFocusEnabled

Introduction

In this page you can find the example usage for javax.swing JComponent isRequestFocusEnabled.

Prototype

public boolean isRequestFocusEnabled() 

Source Link

Document

Returns true if this JComponent should get focus; otherwise returns false.

Usage

From source file:Main.java

/**
 * Request focus on the given component if it doesn't already have it
 * and <code>isRequestFocusEnabled()</code> returns true.
 *///from w  w w.java 2 s. co  m
public static void adjustFocus(JComponent c) {
    if (!c.hasFocus() && c.isRequestFocusEnabled()) {
        c.requestFocus();
    }
}