Java Swing Focus isFocusable(Component component)

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

Description

Return true if the jComponent could receive the focus

License

Open Source License

Parameter

Parameter Description
component a parameter

Declaration

public static boolean isFocusable(Component component) 

Method Source Code


//package com.java2s;
/*/*from   w w w .  ja  va 2s .  c  o  m*/
 * Copyright (c) 2007 Agile-Works
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Agile-Works. ("Confidential Information").
 * You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you
 * entered into with Agile-Works.
 */

import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;

public class Main {
    /**
     * Return true if the jComponent could receive the focus
     *
     * @param component
     * @return
     */
    public static boolean isFocusable(Component component) {
        if (component instanceof JTextComponent || component instanceof JComboBox || component instanceof JCheckBox
                || component instanceof JTable) {
            return true;
        }
        return false;
    }
}

Related

  1. installFocusCycleRoot(Container c, FocusTraversalPolicy cyclePolicy)
  2. installJComponentRepainterOnWindowFocusChanged( JComponent component)
  3. installJComponentRepainterOnWindowFocusChanged(JComponent component)
  4. installJComponentRepainterOnWindowFocusChanged(JComponent component)
  5. isDescendingFrom(Component focusOwner, Component parent)
  6. isFocused(Component component)
  7. isFocused(Component component, boolean recoursive)
  8. isParentWindowFocused(Component component)
  9. isParentWindowFocused(Component component)