Here you can find the source of isCopyEnabled(JComponent targetComponent)
Parameter | Description |
---|---|
targetComponent | a parameter |
public static boolean isCopyEnabled(JComponent targetComponent)
//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; } }