Java JComponent Properties isPasteEnabled(JComponent component)

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

Description

Returns whether the component can perform a paste operation.

License

Open Source License

Parameter

Parameter Description
component the Component to set the enabled state for

Exception

Parameter Description
NullPointerException if component is null

Declaration

private static boolean isPasteEnabled(JComponent component) 

Method Source Code

//package com.java2s;
/*//from w  ww . j a va  2s.  c o m
 * Copyright (C) 2006 Sun Microsystems, Inc. All rights reserved. Use is
 * subject to license terms.
 */

import javax.swing.JComponent;

public class Main {
    private static final Object PASTE_CLIENT_PROPERTY = "__paste__";

    /**
     * Returns whether the component can perform a paste operation.
     *
     * @param component the Component to set the enabled state for
     * @throws NullPointerException if component is null
     */
    private static boolean isPasteEnabled(JComponent component) {
        return getBooleanClientProperty(component, PASTE_CLIENT_PROPERTY);
    }

    private static boolean getBooleanClientProperty(JComponent c,
            Object property) {
        Boolean value = (Boolean) c.getClientProperty(property);
        return (value == null) ? false : value;
    }
}

Related

  1. isHorizontallyVisible(JComponent c, int from, int to)
  2. isMandatory(JComponent comp)
  3. isMarker(JComponent component)
  4. isOver(JComponent c)
  5. isOverlapping(JComponent comp1, JComponent comp2)
  6. isRectangularSelection(JComponent c)
  7. isRequired(JComponent component)
  8. isVisible(JComponent c, Rectangle r)
  9. isVisible(JComponent comp)