Java JComponent Container isCopyEnabled(JComponent targetComponent)

Here you can find the source of isCopyEnabled(JComponent targetComponent)

Description

Testeaza daca o componenta este buna pentru copy

License

Open Source License

Parameter

Parameter Description
targetComponent a parameter

Declaration

public static boolean isCopyEnabled(JComponent targetComponent) 

Method Source Code

//package com.java2s;
/*//from  w  w  w  .  j a va  2s .co  m
 *
 * This file is part of Genome Artist.
 *
 * Genome Artist is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Genome Artist 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Genome Artist.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import javax.swing.JComponent;
import javax.swing.TransferHandler;

public class Main {
    /**
     * Testeaza daca o componenta este buna pentru copy
     * @param targetComponent
     * @return
     */
    public static boolean isCopyEnabled(JComponent targetComponent) {
        TransferHandler transferHandler = targetComponent.getTransferHandler();
        if (transferHandler == null)
            return false;

        int sourceActions = transferHandler.getSourceActions(targetComponent);
        if (sourceActions == TransferHandler.COPY || sourceActions == TransferHandler.COPY_OR_MOVE)
            return true;
        else
            return false;
    }
}

Related

  1. getTopLevelContainer(JComponent component)
  2. getWindow(final JComponent comp)
  3. getWindow(JComponent c)
  4. getWindowLocation(JComponent start)
  5. invokeRepaintOnLayeredRoot(Component leaf, boolean everything)
  6. isPasteEnabled(JComponent targetComponent)
  7. rootPaneForComponent(Component comp)
  8. widgetsEnable(boolean flag, JComponent... comps)