Java JComponent Container getComponentState(JComponent c)

Here you can find the source of getComponentState(JComponent c)

Description

get Component State

License

Open Source License

Declaration

public static int getComponentState(JComponent c) 

Method Source Code

//package com.java2s;
/*/*from   w ww .  j  a  v a  2 s  . c  o m*/
 * $Id$
 *
 * Copyright 2009 Sun Microsystems, Inc., 4150 Network Circle,
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

import javax.swing.JComponent;

import javax.swing.plaf.synth.SynthConstants;

public class Main {
    public static int getComponentState(JComponent c) {
        if (c.isEnabled()) {
            if (c.isFocusOwner()) {
                return SynthConstants.ENABLED | SynthConstants.FOCUSED;
            }
            return SynthConstants.ENABLED;
        }
        return SynthConstants.DISABLED;
    }
}

Related

  1. getClipboard(JComponent c)
  2. getComponent(JComponent container, String name)
  3. getComponent(JComponent container, String name)
  4. getComponentByName(boolean enableDeepSearch, JComponent rootComponent, String name)
  5. getComponentsOfType(JComponent base, Class type)
  6. getDataFlavors(JComponent component)
  7. getDeepestEmptyComponentAt(JComponent parent, Point location)
  8. getFirstChildComponentOfType(Component component, Class childComponentType)
  9. getGlassPane(JComponent comp)